saramibreak / DiscImageCreator

This is the disc (CD, GD, DVD, HD-DVD, BD, GC/Wii, XBOX, XBOX 360) and disk (Floppy, MO, USB etc) image creation tool
http://forum.redump.org/topic/10483/discimagecreator/
Apache License 2.0
509 stars 45 forks source link

Fix HFS time #266

Closed fuzz6001 closed 5 months ago

fuzz6001 commented 5 months ago
tm* ctime = gmtime(&creationTime);
ctime->tm_year -= 66;

Because of the leap year discrepancy, this method cannot be used to obtain the correct day. The year 1904 (Mac/HFS epoch) is a leap year, but 1970 (Unix epoch) is not.

In addition, a minor bug in the last backup date has been fixed.

e.g.

HFS time Correct date/time Current DIC
5011200 1904-02-28T00:00:00 1904-02-28T00:00:00 Good
5097600 1904-02-29T00:00:00 1904-03-01T00:00:00 Bad
3728851200 2022-02-28T00:00:00 2022-02-29T00:00:00 Bad
3728937600 2022-03-01T00:00:00 2022-03-01T00:00:00 Good