10000 Merge pull request #153 from pycom/wipy_mktime_issue · pycom/pycom-micropython-sigfox@bd8fd3b · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit bd8fd3b

Browse files
author
Catalin Ioana
authored
Merge pull request #153 from pycom/wipy_mktime_issue
Fixed the handling of timeoffset in utime.mktime
2 parents 72eacde + 6bb77ec commit bd8fd3b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

esp32/mods/modutime.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(time_gmtime_obj, 0, 1, time_gmtime);
114114
/// \function mktime()
115115
/// This is inverse function of localtime. It's argument is a full 8-tuple
116116
/// which expresses a time as per localtime. It returns an integer which is
117-
/// the number of seconds since Jan 1, 2000.
117+
/// the number of seconds since the Epoch (Jan 1, 1970).
118118
STATIC mp_obj_t time_mktime(mp_obj_t tuple) {
119119
mp_uint_t len;
120120
mp_obj_t *elem;
@@ -125,9 +125,9 @@ STATIC mp_obj_t time_mktime(mp_obj_t tuple) {
125125
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "mktime needs a tuple of length 8 or 9 (%d given)", len));
126126
}
127127

128-
return mp_obj_new_int_from_uint(timezone_offset + timeutils_mktime_since_epoch(mp_obj_get_int(elem[0]),
128+
return mp_obj_new_int(timeutils_mktime_since_epoch(mp_obj_get_int(elem[0]),
129129
mp_obj_get_int(elem[1]), mp_obj_get_int(elem[2]), mp_obj_get_int(elem[3]),
130-
mp_obj_get_int(elem[4]), mp_obj_get_int(elem[5])));
130+
mp_obj_get_int(elem[4]), mp_obj_get_int(elem[5])) - timezone_offset);
131131
}
132132
MP_DEFINE_CONST_FUN_OBJ_1(time_mktime_obj, time_mktime);
133133

0 commit comments

Comments
 (0)
0