Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time on Windows doesn't deal with dates before 1970 #1369

Open
floitsch opened this issue Jan 23, 2023 · 0 comments
Open

Time on Windows doesn't deal with dates before 1970 #1369

floitsch opened this issue Jan 23, 2023 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers platform-windows This issue is for the Windows platform build

Comments

@floitsch
Copy link
Member

floitsch commented Jan 23, 2023

We are using gmtime_s and localtime_s on Windows.

However, both of these functions don't accept negative seconds (since epoch), and thus don't work for dates before 1970.

Currently neither the Windows, nor the Posix versions check that the system calls actually succeed. (Both should).

The nicest is probably to try the system call, and then fall back to an equivalent range if the system call fails. See V8 for how to map to an equivalent range: https://github.com/v8/v8/blob/21ab8287a61ef260a2ae7a38f42426fa6f35c39c/src/date/date.h#L113

Test is currently marked as failing on Windows (permalink to current revision):

tests/time_test.toit

@floitsch floitsch added bug Something isn't working good first issue Good for newcomers platform-windows This issue is for the Windows platform build labels Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers platform-windows This issue is for the Windows platform build
Development

No branches or pull requests

1 participant