Skip to content

Commit 3e5ec40

Browse files
committed
time.localtime: low timestamps are ok if epoch is 2000
1 parent 35ee4ad commit 3e5ec40

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
@@ -248,7 +248,11 @@ STATIC mp_obj_t time_localtime(size_t n_args, const mp_obj_t *args) {
248248

249249
mp_int_t secs = mp_obj_get_int(arg);
250250

251+
#if MICROPY_EPOCH_IS_1970
251252
if (secs < 0 || (mp_uint_t)secs < TIMEUTILS_SECONDS_1970_TO_2000) {
253+
#else
254+
if (secs < 0) {
255+
#endif
252256
mp_raise_msg(&mp_type_OverflowError, translate("timestamp out of range for platform time_t"));
253257
}
254258

0 commit comments

Comments
 (0)