FileTime problem - converting from local time

Giganews Newsgroups
Subject: FileTime problem - converting from local time
Posted by:  R.Wieser (addre…@not.available)
Date: Sun, 27 Oct 2019

Hello all,

I'm setting the LastWriteTime of a file (using SetFileTime), but only have a
local filetime.  So, I first converted using
TzSpecificLocalTimeToSystemTime.  The only problem is, for one of the
times*, that although the conversion returns the expected UTC time, when I
look at the file in "windows explorer" it shows to be an hour older/before
the supplied time.

Remark: The target drive drive is NTFS, so AFAIK no time shennigans as
happens with FAT32 drives.

* the problematic local time is from within the daylight-savings period,
while I'm currently outside of it.  For the problematic time it shows, as
expected, two hours being subtracted.

-- Correct time (No DLS, same as current one)
2018/11/07 10:31.28 <-- Local time
2018/11/07 09:31.28 <-- applied to the file
2018/11/07 10:31.38 <-- Time shown

-- Problematic time (DLS, different to current one)
2019/10/25 14:51.52 <-- Local time
2019/10/25 12:51.52 <-- applied to the file
2019/10/25 13:51.52 <-- Time shown

(the above date is in  yyyy/mm/dd format)

In other words, I /think/ I applied the right LastWriteTime to the file, and
am stumped to where the displayed time difference comes from ... Help ?

Regards,
Rudy Wieser

Replies