photools.com Community

IMatch Bug Reports and Feature Requests => Bug Reports => Solved Bug Reports (for next version) => Topic started by: sdb on July 24, 2023, 03:02:33 PM

Title: DST calculation wrong
Post by: sdb on July 24, 2023, 03:02:33 PM
I just read the following in https://www.photools.com/help/imatch/how-imatch-uses-date-and-time.htm:
QuoteIMatch uses date & time conversion routines which rely on a time zone database in order to tell if DST was active (locally) for a specific date. The results of the local time conversion hence take DST into account, shifting +1/ one hour, depending on the date portion of the timestamp and the date.

An excellent feature, if I understand it correctly  But I can't seem to get it to work.

I used as a test an image with all the metadata stripped out and a single date (1 March 2023) added to Exif:DateTimeOriginal.  No time offset is present.

I used the File.DateTime mapping mode 2 (the default).

My current Windows time zone is Europe/London (+01:00, because of DST).

I add the file to the database. VarToy shows:
File.DateTime.UTCOffset - +01:00
File.DateTime - 01/03/2023 12:00:00
File.DateTime.TZO - 01/03/2023 12:00:00+01:00
File.DateTime.Original - 01/03/2023 12:00:00
File.DateTime.UTC - 01/03/2023 11:00:00
File.DateTime.UTC.TZO - 01/03/2023 11:00:00Z
File.DateTime.Local - 01/03/2023 11:00:00
File.DateTime.Local.TZO - 01/03/2023 11:00:00+01:00
File.MD.XMP::photoshop\DateCreated\DateCreated\0 - 2023:03:01 12:00:00+01:00
File.MD.XMP::xmp\CreateDate\CreateDate\0 - 2023:03:01 12:00:00+01:00

The conversion routine should have determined that DST was not active (locally) for the specific date of 1 March 2023, but instead it used the current TZO, including DST.

Have I misunderstood something?
Title: Re: DST calculation wrong
Post by: Mario on July 25, 2023, 02:59:36 PM
I have resolved this issue for the next update.
Under some condition, the current local time zone was applied to the FW attribute and the corresponding variable, without taking the DST setting at the date into account.

An image with an UTC timestamp of 12:00:00 should show in the German time zone (UTC+01:00):

a) when taken in March: 13:00:00+01:00
b) when taken in July: 14:00:00+02:00

Title: Re: DST calculation wrong
Post by: sdb on July 25, 2023, 03:38:13 PM
Thanks again Mario.
Title: Re: DST calculation wrong
Post by: Mario on July 25, 2023, 05:33:36 PM
Thanks for reporting the problem.
Bugs I can reproduce, I can fix (usually) quickly.