[Box Backup-dev] COMMIT r691 - box/chris/general/lib/backupclient
boxbackup-dev@fluffy.co.uk
boxbackup-dev@fluffy.co.uk
Wed, 26 Jul 2006 19:09:09 +0000 (GMT)
Author: chris
Date: 2006-07-26 19:09:05 +0000 (Wed, 26 Jul 2006)
New Revision: 691
Modified:
box/chris/general/lib/backupclient/BackupClientFileAttributes.cpp
Log:
* BackupClientFileAttributes.cpp
- Restore timestamps on restored files under Win32 (experimental)
Modified: box/chris/general/lib/backupclient/BackupClientFileAttributes.cpp
===================================================================
--- box/chris/general/lib/backupclient/BackupClientFileAttributes.cpp 2006-07-25 23:04:20 UTC (rev 690)
+++ box/chris/general/lib/backupclient/BackupClientFileAttributes.cpp 2006-07-26 19:09:05 UTC (rev 691)
@@ -681,10 +681,24 @@
{
// Work out times as timevals
struct timeval times[2];
+
+ #ifdef WIN32
+ BoxTimeToTimeval(box_ntoh64(pattr->ModificationTime),
+ times[1]);
+ BoxTimeToTimeval(box_ntoh64(pattr->AttrModificationTime),
+ times[0]);
+ // Because stat() returns the creation time in the ctime
+ // field under Windows, and this gets saved in the
+ // AttrModificationTime field of the serialised attributes,
+ // we subvert the first parameter of emu_utimes() to allow
+ // it to be reset to the right value on the restored file.
+ #else
BoxTimeToTimeval(modtime, times[1]);
// Copy access time as well, why not, got to set it to something
times[0] = times[1];
- // Attr modification time will be changed anyway, nothing that can be done about it
+ // Attr modification time will be changed anyway,
+ // nothing that can be done about it
+ #endif
// Try to apply
if(::utimes(Filename, times) != 0)