Closed ignatenkobrain closed 6 years ago
These are both Year 2038 problems. upper_bound
is testing "9999-12-31T23:59:59Z", and random_wide_range
is trying to generate times anywhere from the epoch 0 to that same endpoint.
Okay, I've fixed tests by conditional compilation in 02d0e7d, as well as actual runtime panic on parsing large timestamps. The problem is that because the implementation of SystemTime is platform specific the limits may be different between platforms. And there is neither SystemTime::MAX
nor SystemTime::checked_add
which could help.
I've added a check that ensures that 32bit platform has 2038-year problem. But no I realized that wasm32 does not have this problem. An I should also check at least windows somehow.
Any thoughts?
It's definitely messy. Here's what I found for SystemTime
implementations:
cloudabi
uses abi::timestamp
-> 64-bit ns -> ~585 years from UNIX_EPOCH
.windows
uses FILETIME
-> 64-bit 100ns units -> 58,500 years from Jan 1, 1601.wasm
uses Duration
-> 64-bit seconds, no problem.timespec
, with 32/64-bit time_t
seconds for 32/64-bit arches.@cuviper please take a look at PR #3 . Implementation is mostly as in your comment except I believe that emscripten uses 32bit time_t too, that's only wasm32-unknown-unknown which uses full Duration.
I think the issue is fixed. Please reopen if it's not.