diff options
| author | Scott Shawcroft <scott@adafruit.com> | 2020-12-02 12:51:43 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-02 12:51:43 -0800 |
| commit | d7ba641ff646b48e5ad38ff72a2dcfe17bb54624 (patch) | |
| tree | a0c4f9fb561b2caa38636645ca27f0ddad59f087 /shared-bindings/time | |
| parent | 5b3c930e384ef6440f0f7b5167bb54ea68a8be76 (diff) | |
| parent | 72fa7d88b881d2ed9978c0bd65ce5f8d6eb51703 (diff) | |
Merge pull request #3767 from dhalbert/sleep
Initial alarm and sleep PR: time alarms with light and deep sleep; PinAlarms not yet implemented
Diffstat (limited to 'shared-bindings/time')
| -rw-r--r-- | shared-bindings/time/__init__.c | 5 | ||||
| -rw-r--r-- | shared-bindings/time/__init__.h | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/shared-bindings/time/__init__.c b/shared-bindings/time/__init__.c index 44f82c62e..2624384af 100644 --- a/shared-bindings/time/__init__.c +++ b/shared-bindings/time/__init__.c @@ -51,9 +51,8 @@ //| ... //| STATIC mp_obj_t time_monotonic(void) { - uint64_t time64 = common_hal_time_monotonic(); - // 4294967296 = 2^32 - return mp_obj_new_float(((uint32_t) (time64 >> 32) * 4294967296.0f + (uint32_t) (time64 & 0xffffffff)) / 1000.0f); + uint64_t ticks_ms = common_hal_time_monotonic_ms(); + return mp_obj_new_float(uint64_to_float(ticks_ms) / 1000.0f); } MP_DEFINE_CONST_FUN_OBJ_0(time_monotonic_obj, time_monotonic); diff --git a/shared-bindings/time/__init__.h b/shared-bindings/time/__init__.h index ec96aea24..4e716e9df 100644 --- a/shared-bindings/time/__init__.h +++ b/shared-bindings/time/__init__.h @@ -35,7 +35,7 @@ extern mp_obj_t struct_time_from_tm(timeutils_struct_time_t *tm); extern void struct_time_to_tm(mp_obj_t t, timeutils_struct_time_t *tm); -extern uint64_t common_hal_time_monotonic(void); +extern uint64_t common_hal_time_monotonic_ms(void); extern uint64_t common_hal_time_monotonic_ns(void); extern void common_hal_time_delay_ms(uint32_t); |
