Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Woazboat
firmware
Commits
4c74f061
Commit
4c74f061
authored
5 years ago
by
fpletz
Committed by
schneider
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix(utime.c): set_time should operate in local tz
Needed due to changes from
8c59935e
. cc
!146
parent
e0824843
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Documentation/pycardium/utime.rst
+5
-3
5 additions, 3 deletions
Documentation/pycardium/utime.rst
pycardium/modules/utime.c
+2
-2
2 additions, 2 deletions
pycardium/modules/utime.c
with
7 additions
and
5 deletions
Documentation/pycardium/utime.rst
+
5
−
3
View file @
4c74f061
...
@@ -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.
...
...
This diff is collapsed.
Click to expand it.
pycardium/modules/utime.c
+
2
−
2
View file @
4c74f061
...
@@ -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
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment