From 0d0928c5a835807c3b368eeb383c4c03e0fe5a69 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sun, 17 Jul 2022 15:52:52 +0200 Subject: [PATCH] bugfix uptime() rollover --- src/reset.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/reset.cpp b/src/reset.cpp index b67d8dae..f62cb54b 100644 --- a/src/reset.cpp +++ b/src/reset.cpp @@ -200,9 +200,9 @@ void enter_deepsleep(const uint64_t wakeup_sec, gpio_num_t wakeup_gpio) { // time stamp sleep start time and save system monotonic time. Deep sleep. gettimeofday(&RTC_sleep_start_time, NULL); - RTC_millis += millis(); + RTC_millis += esp_timer_get_time() / 1000; ESP_LOGI(TAG, "Going to sleep, good bye."); esp_deep_sleep_start(); } -unsigned long long uptime() { return (RTC_millis + millis()); } \ No newline at end of file +unsigned long long uptime() { return (RTC_millis + esp_timer_get_time() / 1000); } \ No newline at end of file