vincenthz/hs-hourglass

[Windows] Cannot print dates before January 1, 1601

Elewyth opened this issue · 1 comments

When trying to print a DateTime before Janurary 1, 1601 as follows:

timePrint ISO8601_DateAndTime (DateTime
    (Date 1600 December 31)
    (TimeOfDay 23 59 59 999_999_999))

The following exception is thrown on a Windows system:

uncaught exception: IOException of type InvalidArgument
fileTimeToSystemTime: FileTimeToSystemTime: invalid argument (The parameter is incorrect.)

This seems to be caused by the underlying library https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-filetime being used, which explicitly only supports dates after 1601-01-01.

Possible resolution:
Seems like the only possible solution to this issue would be to use a different Windows-API for this functionality.

Sorry. I was going to comment and then I realised this is not relevant to your question.