Skip to content

Commit

Permalink
Switch to UTC time
Browse files Browse the repository at this point in the history
  • Loading branch information
thebrandre committed Feb 17, 2024
1 parent e7b215c commit 9a1b21b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion InMemoryArchiveUpdateCallback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,20 @@ Z7_COM7F_IMF(InMemoryArchiveUpdateCallback::GetProperty(UInt32 index, PROPID pro
value->vt = VT_UI4;
value->ulVal = IsDirectory ? FILE_ATTRIBUTE_DIRECTORY : 0;
break;
case kpidCTime:
case kpidMTime:
{
const auto ModifiedTime = Archive->FileSystem.getModifiedTime(index);
const auto FileTime64 = getFileTimeFromUnixTime(std::chrono::duration_cast<std::chrono::seconds>(ModifiedTime.time_since_epoch()).count());
value->vt = VT_FILETIME;
value->filetime = {};
value->filetime.dwLowDateTime = (DWORD)FileTime64;
value->filetime.dwHighDateTime = (DWORD)(FileTime64 >> 32);

//FILETIME Filetime;
//GetSystemTimeAsFileTime(&Filetime);
//value->vt = VT_FILETIME;
//value->filetime = Filetime;
break;
}
case kpidHardLink:
Expand All @@ -112,7 +119,6 @@ Z7_COM7F_IMF(InMemoryArchiveUpdateCallback::GetProperty(UInt32 index, PROPID pro
value->vt = VT_UI8;
value->uhVal.QuadPart = Archive->FileSystem.getFileSize(index);
break;
case kpidCTime: break;
case kpidATime: break;
case kpidPosixAttrib: break;
}
Expand Down
2 changes: 1 addition & 1 deletion InMemoryFileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ InMemoryFile InMemoryFileSystem::createFile(PathType Path, FileView BinaryConten
NewFile.Path = Path;
NewFile.Hash = Hash;
BlobStorage.emplace(Hash, FileType{ std::ranges::begin(BinaryContent) , std::ranges::end(BinaryContent) });
ModifiedTime = std::chrono::system_clock::now();
ModifiedTime = std::chrono::utc_clock::now();
return NewFile;
}

Expand Down
2 changes: 1 addition & 1 deletion InMemoryFileSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class InMemoryFileSystem
using PathView = InMemoryFile::PathView;
using HashType = InMemoryFile::HashType;
using FileView = std::span<const std::byte>;
using TimePointType = std::chrono::time_point<std::chrono::system_clock>;
using TimePointType = std::chrono::time_point<std::chrono::utc_clock>;

InMemoryFile createFile(PathType Path, FileView BinaryContent);
std::uint64_t getFileSize(size_t Index) const noexcept;
Expand Down

0 comments on commit 9a1b21b

Please sign in to comment.