time.localtime: low timestamps are ok if epoch is 2000
This commit is contained in:
parent
35ee4add63
commit
3e5ec403fb
@ -248,7 +248,11 @@ STATIC mp_obj_t time_localtime(size_t n_args, const mp_obj_t *args) {
|
|||||||
|
|
||||||
mp_int_t secs = mp_obj_get_int(arg);
|
mp_int_t secs = mp_obj_get_int(arg);
|
||||||
|
|
||||||
|
#if MICROPY_EPOCH_IS_1970
|
||||||
if (secs < 0 || (mp_uint_t)secs < TIMEUTILS_SECONDS_1970_TO_2000) {
|
if (secs < 0 || (mp_uint_t)secs < TIMEUTILS_SECONDS_1970_TO_2000) {
|
||||||
|
#else
|
||||||
|
if (secs < 0) {
|
||||||
|
#endif
|
||||||
mp_raise_msg(&mp_type_OverflowError, translate("timestamp out of range for platform time_t"));
|
mp_raise_msg(&mp_type_OverflowError, translate("timestamp out of range for platform time_t"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user