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
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
card10
firmware
Commits
e0691c6d
Commit
e0691c6d
authored
5 years ago
by
Ferdinand Bachmann
Browse files
Options
Downloads
Patches
Plain Diff
pycardium/modules/utime.c: add bindings for monotonic time
parent
e94f7bf9
Branches
Branches containing commit
No related tags found
1 merge request
!285
Add monotonic time
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pycardium/modules/qstrdefs.h
+2
-0
2 additions, 0 deletions
pycardium/modules/qstrdefs.h
pycardium/modules/utime.c
+18
-0
18 additions, 0 deletions
pycardium/modules/utime.c
with
20 additions
and
0 deletions
pycardium/modules/qstrdefs.h
+
2
−
0
View file @
e0691c6d
...
@@ -47,6 +47,8 @@ Q(ticks_add)
...
@@ -47,6 +47,8 @@ Q(ticks_add)
Q
(
ticks_diff
)
Q
(
ticks_diff
)
Q
(
localtime
)
Q
(
localtime
)
Q
(
mktime
)
Q
(
mktime
)
Q
(
monotonic
)
Q
(
monotonic_ms
)
Q
(
time
)
Q
(
time
)
Q
(
time_ms
)
Q
(
time_ms
)
Q
(
set_time
)
Q
(
set_time
)
...
...
This diff is collapsed.
Click to expand it.
pycardium/modules/utime.c
+
18
−
0
View file @
e0691c6d
...
@@ -51,6 +51,22 @@ static mp_obj_t time_time_ms(void)
...
@@ -51,6 +51,22 @@ static mp_obj_t time_time_ms(void)
}
}
MP_DEFINE_CONST_FUN_OBJ_0
(
time_time_ms_obj
,
time_time_ms
);
MP_DEFINE_CONST_FUN_OBJ_0
(
time_time_ms_obj
,
time_time_ms
);
static
mp_obj_t
time_monotonic
(
void
)
{
mp_int_t
seconds
;
seconds
=
epic_rtc_get_monotonic_seconds
();
return
mp_obj_new_int
(
seconds
);
}
MP_DEFINE_CONST_FUN_OBJ_0
(
time_monotonic_obj
,
time_monotonic
);
static
mp_obj_t
time_monotonic_ms
(
void
)
{
uint64_t
milliseconds
;
milliseconds
=
epic_rtc_get_monotonic_milliseconds
();
return
mp_obj_new_int_from_ull
(
milliseconds
);
}
MP_DEFINE_CONST_FUN_OBJ_0
(
time_monotonic_ms_obj
,
time_monotonic_ms
);
static
mp_obj_t
time_localtime
(
size_t
n_args
,
const
mp_obj_t
*
args
)
static
mp_obj_t
time_localtime
(
size_t
n_args
,
const
mp_obj_t
*
args
)
{
{
mp_int_t
seconds
;
mp_int_t
seconds
;
...
@@ -130,6 +146,8 @@ static const mp_rom_map_elem_t time_module_globals_table[] = {
...
@@ -130,6 +146,8 @@ static const mp_rom_map_elem_t time_module_globals_table[] = {
{
MP_ROM_QSTR
(
MP_QSTR___name__
),
MP_ROM_QSTR
(
MP_QSTR_utime
)
},
{
MP_ROM_QSTR
(
MP_QSTR___name__
),
MP_ROM_QSTR
(
MP_QSTR_utime
)
},
{
MP_ROM_QSTR
(
MP_QSTR_time
),
MP_ROM_PTR
(
&
time_time_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_time
),
MP_ROM_PTR
(
&
time_time_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_time_ms
),
MP_ROM_PTR
(
&
time_time_ms_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_time_ms
),
MP_ROM_PTR
(
&
time_time_ms_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_monotonic
),
MP_ROM_PTR
(
&
time_monotonic_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_monotonic_ms
),
MP_ROM_PTR
(
&
time_monotonic_ms_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_set_time
),
MP_ROM_PTR
(
&
time_set_time_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_set_time
),
MP_ROM_PTR
(
&
time_set_time_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_set_unix_time
),
{
MP_ROM_QSTR
(
MP_QSTR_set_unix_time
),
MP_ROM_PTR
(
&
time_set_unix_time_obj
)
},
MP_ROM_PTR
(
&
time_set_unix_time_obj
)
},
...
...
This diff is collapsed.
Click to expand it.
Ferdinand Bachmann
@yrlf
mentioned in commit
f1251d66
·
5 years ago
mentioned in commit
f1251d66
mentioned in commit f1251d66f73015939baaa0a5ce4c862e3d0da268
Toggle commit list
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