Skip to content

Commit 698a392

Browse files
authored
Merge pull request #4762 from Neradoc/small-timestamps-if-epoch-2000
time.localtime: low timestamps when epoch is 2000
2 parents e528d8d + 3e5ec40 commit 698a392

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

shared-bindings/time/__init__.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,11 @@ STATIC mp_obj_t time_localtime(size_t n_args, const mp_obj_t *args) {
250250

251251
mp_int_t secs = mp_obj_get_int(arg);
252252

253+
#if MICROPY_EPOCH_IS_1970
253254
if (secs < 0 || (mp_uint_t)secs < TIMEUTILS_SECONDS_1970_TO_2000) {
255+
#else
256+
if (secs < 0) {
257+
#endif
254258
mp_raise_msg(&mp_type_OverflowError, translate("timestamp out of range for platform time_t"));
255259
}
256260

0 commit comments

Comments
 (0)