mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 15:29:55 +00:00
Fix dumb regression, initialize "std::filesystem::file_time_type" with "clock::now()".
This commit is contained in:
parent
5cf2a958eb
commit
6fe89ff22b
3 changed files with 11 additions and 7 deletions
|
@ -79,7 +79,7 @@ void MWState::Character::addSlot(const ESM::SavedGame& profile)
|
|||
}
|
||||
|
||||
slot.mProfile = profile;
|
||||
slot.mTimeStamp = std::filesystem::file_time_type();
|
||||
slot.mTimeStamp = std::filesystem::file_time_type::clock::now();
|
||||
|
||||
mSlots.push_back(slot);
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ const MWState::Slot* MWState::Character::updateSlot(const Slot* slot, const ESM:
|
|||
|
||||
Slot newSlot = *slot;
|
||||
newSlot.mProfile = profile;
|
||||
newSlot.mTimeStamp = std::filesystem::file_time_type();
|
||||
newSlot.mTimeStamp = std::filesystem::file_time_type::clock::now();
|
||||
|
||||
mSlots.erase(mSlots.begin() + index);
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace fx
|
|||
: mName(std::move(name))
|
||||
, mFileName(Files::pathToUnicodeString(
|
||||
(Files::pathFromUnicodeString(Technique::sSubdir) / (mName + Technique::sExt))))
|
||||
, mLastModificationTime(std::filesystem::file_time_type())
|
||||
, mLastModificationTime(std::filesystem::file_time_type::clock::now())
|
||||
, mWidth(width)
|
||||
, mHeight(height)
|
||||
, mVFS(vfs)
|
||||
|
|
|
@ -5,12 +5,16 @@
|
|||
|
||||
namespace Misc
|
||||
{
|
||||
template <typename TP>
|
||||
inline std::time_t toTimeT(TP tp)
|
||||
inline std::time_t toTimeT(std::filesystem::file_time_type tp)
|
||||
{
|
||||
using namespace std::chrono;
|
||||
auto sctp = time_point_cast<system_clock::duration>(tp - TP::clock::now() + system_clock::now());
|
||||
return system_clock::to_time_t(sctp);
|
||||
#if __cpp_lib_chrono >= 201907
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue