"Change Timestamp" & DST

Bugs found in XnView Classic. Please report only one bug per topic!

Moderators: XnTriq, xnview

Post Reply
schach
Posts: 1
Joined: Mon Jul 18, 2016 1:12 pm

"Change Timestamp" & DST

Post by schach » Mon Jul 18, 2016 1:45 pm

There's still the following problem, if "Automatic change for daylight saving time" in Windows is active (I'm using Windows 7)

In case of using "change timestamp" and choose a date which is within the other seasonal time of the current computer's time, than a 1h-wrong time is allocated to the file.
Example: today (July 18th) daylight saving time is active, but I want to change the timestamp of a file which was shot on January 1st (no daylight saving time) to 12.00h:
XnView by mistake allocates a timestamp of 11.00h
Screen.jpg
Screen.jpg (42.91 KiB) Viewed 1152 times

User avatar
larsen
Posts: 58
Joined: Thu Mar 20, 2008 10:07 am

Re: "Change Timestamp" & DST

Post by larsen » Mon Jul 18, 2016 1:57 pm

This thread has been solved 1,5 years ago. It would be better to start a new thread.

User avatar
XnTriq
Moderator & Librarian
Posts: 5401
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: "Change Timestamp" & DST

Post by XnTriq » Mon Jul 18, 2016 7:30 pm

Bug confirmed :bugconfirmed:

User avatar
XnTriq
Moderator & Librarian
Posts: 5401
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: "Change Timestamp" & DST

Post by XnTriq » Mon Jul 18, 2016 11:30 pm

Phil Harvey (ExifTool Forum » [url=http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,5305.msg25746.html#msg25746]Daylight Savings Time Bug of Windows[/url]) wrote:I have good news, and bad news.

First the good news:
  • I found a Perl package called Win32::UTCFileTime that supposedly patches the stat() and utime() library functions to fix this Windows deficiency.
Now the bad news:
  • The Win32::UTCFileTime routines may be called with a file name only, and don't support being called with a file handle, which ExifTool requires.
  • The Win32::UTCFileTime routines don't override the Perl file test operators, so I would need to change all these to stat() calls in the code, which would be ugly.
but here is the real killer:
  • On my Windows development machine (XP SP2) with ""Automatically Adjust for Daylight Savings Time" enabled, the ExifTool FileModifyDate matches exactly that reported by Windows Explorer for files on an NTFS filesystem, even when I change the system date/time in and out of DST. But with the Win32::UTCFileTime patch, the stat() times change so they no longer match those reported by Windows Explorer.
This last point is huge. I am guessing that Microsoft changed the time zone handling some time after XP SP2, which makes this a Windows-version-dependent or Windows-settings-dependent problem. Given that ExifTool seems to report the correct FileModifyDate on my development system, I am lothe to change this behaviour and break the backward compatibility for systems like the one I am running.

So the bottom line is that I don't see any good way that I can patch this Windows problem.
MSKB ([url=http://support.microsoft.com/kb/2400550]Timing and scheduling issues after a daylight saving time update or time zone update[/url]) wrote:
  1. Import the applicable TZI and annual rules into the registry under the following registry subkey:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones
    Note If registry value does not exist, import the English string into the registry under the following registry subkey for the "Non-MUI_*" string (for example: "Display", "Dlt", "••• SPAM •••" registry keys):
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones
  2. Run the appropriate command for your operating system:
    Windows XP and Windows Server 2003
    • Tzchange.exe /w 2147483648
    Windows Vista, Windows 7, Windows Server 2008 and Windows Server 2008 R2
    • %Windows%\servicing\GC32\tzupd.exe

User avatar
xnview
Author of XnView
Posts: 31175
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: "Change Timestamp" & DST

Post by xnview » Wed Jul 20, 2016 9:01 am

XnTriq wrote:Bug confirmed :bugconfirmed:
you are on Windows 7 too?
Pierre.

User avatar
XnTriq
Moderator & Librarian
Posts: 5401
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: "Change Timestamp" & DST

Post by XnTriq » Wed Jul 20, 2016 10:30 pm

xnview wrote:
XnTriq wrote:Bug confirmed :bugconfirmed:
you are on Windows 7 too?
Sorry, I should have mentioned that I've done my tests on XP SP3 (with KB2904266 installed) where the problem also seems to depend on whether or not Automatically adjust clock for daylight saving time (Control Panel » Date and Time » Time Zone) is activated.
p133205_1.png
NTFS @ XP SP3: "Auto-adjust clock for DST" disabled
p133205_2.png
NTFS @ XP SP3: "Auto-adjust clock for DST" enabled

Post Reply