"Is it possible to check if such a date is in the range of DST for that year"
To some extent: Yes.
First, if the file system where the file reside is NTFS then the time will be UTC.
If it's a FAT file system, the time will be the computer local time.
GetVolumeInformation() give file system.
See GetTimeZoneInformation() to get computer time zone.
Lets use "Eastern Standard Time" for now...
In the registry, at
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Eastern Standard Time\"
you will see a "TZI" value that represent the current daylight start and end in REG_TZI_FORMAT.
In the sub key "Dynamic DST" you will see for many time zone a "FirstEntry" and a "LastEntry"
representing the years covered by this registry branches.
For each year entry, like "2006", "2007",
you will get a "TZI" value that represent the new daylight dates for that year and up.
A "TZI" registry entry is related to TIME_ZONE_INFORMATION.
Read:
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
Creating a Tzi function to parse all elements is a good idea in my view.
An important thing about TZI is that both SYSTEMTIME\wDay means the week of the month, from 1 to 5.
If 5, this indicates the last week of the month, Fifth week or fourth week if there is no fifth.
So you can have something like: The first Sunday of the third week in may.
So, long story short:
Is disk FAT or NTFS?
Get File date.
Current year is current "TZI" else for previous year,
enumerate and check "Dynamic DST" registry entry for a valid year span.
If the file year is within a "Dynamic DST" year range then
you know the start and ending daylight date plus the offset time in minutes.
Depending on the OS compatibility you want, some APIs may make life easier...
GetSystemTimeAdjustment 2000+ Determines whether the system is applying periodic time adjustments to its time-of-day clock.
SystemTimeToTzSpecificLocalTime 2000+ Converts a UTC time to a specified time zone's corresponding local time.
SystemTimeToTzSpecificLocalTimeEx Win7+ Converts a UTC time with dynamic daylight saving time settings to a specified time zone's corresponding local time.
TzSpecificLocalTimeToSystemTime XP+ Converts a local time to a UTC time.
TzSpecificLocalTimeToSystemTimeEx Win7+ Converts a local time with dynamic daylight saving time settings to UTC time.
EnumDynamicTimeZoneInformation Win8+ Enumerates dynamic daylight saving time information entries stored in the registry.
GetDynamicTimeZoneInformation Vista+ Retrieves the current time zone and dynamic daylight saving time settings.
GetTimeZoneInformationForYear Vista+ Retrieves the time zone settings for the specified year and time zone.