Skip to content
Snippets Groups Projects
Commit 4c74f061 authored by fpletz's avatar fpletz :snowflake: Committed by schneider
Browse files

fix(utime.c): set_time should operate in local tz

Needed due to changes from 8c59935e.

cc !146
parent e0824843
No related branches found
No related tags found
No related merge requests found
...@@ -25,16 +25,18 @@ alarm. ...@@ -25,16 +25,18 @@ alarm.
.. py:function:: time() .. py:function:: time()
Return the current timestamp in seconds since 2000-01-01 00:00. Return the current timestamp in seconds since 2000-01-01 00:00 in
the local timezone.
.. py:function:: set_time(secs) .. py:function:: set_time(secs)
Sets the time to ``secs`` seconds since 2000-01-01 00:00. Sets the time to ``secs`` seconds since 2000-01-01 00:00 in the local
timezone.
.. py:function:: set_unix_time(secs) .. py:function:: set_unix_time(secs)
Sets the time to ``secs`` seconds since 1970-01-01 00:00 UTC. Sets the time to ``secs`` seconds since 1970-01-01 00:00 UTC.
This corresponds a regular Unix timestamp which can be obtained This corresponds to a regular Unix timestamp which can be obtained
by running ``date +%s`` in a command line or ``int(time.time())`` by running ``date +%s`` in a command line or ``int(time.time())``
in Python. in Python.
......
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
static mp_obj_t time_set_time(mp_obj_t secs) static mp_obj_t time_set_time(mp_obj_t secs)
{ {
uint64_t timestamp = uint64_t timestamp = mp_obj_get_int(secs) * 1000ULL +
mp_obj_get_int(secs) * 1000ULL + EPOCH_OFFSET * 1000ULL; EPOCH_OFFSET * 1000ULL + TZONE_OFFSET;
epic_rtc_set_milliseconds(timestamp); epic_rtc_set_milliseconds(timestamp);
return mp_const_none; return mp_const_none;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment