From 0d8a81137c4c007c3025261339c299ec8fcc0faf Mon Sep 17 00:00:00 2001 From: Ink Date: Fri, 6 Jan 2017 03:31:32 +0300 Subject: [PATCH] * make vfs::Entry time stamps consistent (as Windows FILETIME) --- src/xenia/vfs/devices/disc_image_device.cc | 8 +++++--- src/xenia/vfs/devices/stfs_container_device.cc | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/xenia/vfs/devices/disc_image_device.cc b/src/xenia/vfs/devices/disc_image_device.cc index d13a73805..b2a4ab5e4 100644 --- a/src/xenia/vfs/devices/disc_image_device.cc +++ b/src/xenia/vfs/devices/disc_image_device.cc @@ -127,9 +127,11 @@ bool DiscImageDevice::ReadEntry(ParseState* state, const uint8_t* buffer, entry->attributes_ = attributes | kFileAttributeReadOnly; entry->size_ = length; entry->allocation_size_ = xe::round_up(length, bytes_per_sector()); - entry->create_timestamp_ = 0; - entry->access_timestamp_ = 0; - entry->write_timestamp_ = 0; + + // Set to January 1, 1601 (UTC) in 100-nanosecond intervals + entry->create_timestamp_ = 10000 * 11644473600000LL; + entry->access_timestamp_ = 10000 * 11644473600000LL; + entry->write_timestamp_ = 10000 * 11644473600000LL; if (attributes & kFileAttributeDirectory) { // Folder. diff --git a/src/xenia/vfs/devices/stfs_container_device.cc b/src/xenia/vfs/devices/stfs_container_device.cc index 0e4c80682..4f5776262 100644 --- a/src/xenia/vfs/devices/stfs_container_device.cc +++ b/src/xenia/vfs/devices/stfs_container_device.cc @@ -184,9 +184,11 @@ StfsContainerDevice::Error StfsContainerDevice::ReadAllEntries( } entry->size_ = file_size; entry->allocation_size_ = xe::round_up(file_size, bytes_per_sector()); - entry->create_timestamp_ = update_timestamp; - entry->access_timestamp_ = access_timestamp; - entry->write_timestamp_ = update_timestamp; + + // Convert to 100-nanosecond intervals since January 1, 1601 (UTC) + entry->create_timestamp_ = (update_timestamp + 11644473600000LL) * 10000; + entry->access_timestamp_ = (access_timestamp + 11644473600000LL) * 10000; + entry->write_timestamp_ = (update_timestamp + 11644473600000LL) * 10000; all_entries.push_back(entry.get()); // Fill in all block records.