mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-30 03:32:36 +00:00
Fix dumb regression, initialize "std::filesystem::file_time_type" with "clock::now()".
This commit is contained in:
parent
5cf2a958eb
commit
6fe89ff22b
@ -79,7 +79,7 @@ void MWState::Character::addSlot(const ESM::SavedGame& profile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
slot.mProfile = profile;
|
slot.mProfile = profile;
|
||||||
slot.mTimeStamp = std::filesystem::file_time_type();
|
slot.mTimeStamp = std::filesystem::file_time_type::clock::now();
|
||||||
|
|
||||||
mSlots.push_back(slot);
|
mSlots.push_back(slot);
|
||||||
}
|
}
|
||||||
@ -157,7 +157,7 @@ const MWState::Slot* MWState::Character::updateSlot(const Slot* slot, const ESM:
|
|||||||
|
|
||||||
Slot newSlot = *slot;
|
Slot newSlot = *slot;
|
||||||
newSlot.mProfile = profile;
|
newSlot.mProfile = profile;
|
||||||
newSlot.mTimeStamp = std::filesystem::file_time_type();
|
newSlot.mTimeStamp = std::filesystem::file_time_type::clock::now();
|
||||||
|
|
||||||
mSlots.erase(mSlots.begin() + index);
|
mSlots.erase(mSlots.begin() + index);
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ namespace fx
|
|||||||
: mName(std::move(name))
|
: mName(std::move(name))
|
||||||
, mFileName(Files::pathToUnicodeString(
|
, mFileName(Files::pathToUnicodeString(
|
||||||
(Files::pathFromUnicodeString(Technique::sSubdir) / (mName + Technique::sExt))))
|
(Files::pathFromUnicodeString(Technique::sSubdir) / (mName + Technique::sExt))))
|
||||||
, mLastModificationTime(std::filesystem::file_time_type())
|
, mLastModificationTime(std::filesystem::file_time_type::clock::now())
|
||||||
, mWidth(width)
|
, mWidth(width)
|
||||||
, mHeight(height)
|
, mHeight(height)
|
||||||
, mVFS(vfs)
|
, mVFS(vfs)
|
||||||
|
@ -5,12 +5,16 @@
|
|||||||
|
|
||||||
namespace Misc
|
namespace Misc
|
||||||
{
|
{
|
||||||
template <typename TP>
|
inline std::time_t toTimeT(std::filesystem::file_time_type tp)
|
||||||
inline std::time_t toTimeT(TP tp)
|
|
||||||
{
|
{
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
auto sctp = time_point_cast<system_clock::duration>(tp - TP::clock::now() + system_clock::now());
|
#if __cpp_lib_chrono >= 201907
|
||||||
return system_clock::to_time_t(sctp);
|
const auto systemTime = clock_cast<system_clock>(tp);
|
||||||
|
#else
|
||||||
|
auto systemTime = time_point_cast<system_clock::duration>(
|
||||||
|
tp - std::filesystem::file_time_type::clock::now() + system_clock::now());
|
||||||
|
#endif
|
||||||
|
return system_clock::to_time_t(systemTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string timeTToString(const std::time_t tp, const char* fmt)
|
inline std::string timeTToString(const std::time_t tp, const char* fmt)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user