From 8efa73b1ca878f6373fbecbec50137bbe708a3d7 Mon Sep 17 00:00:00 2001 From: shufps Date: Fri, 13 Sep 2024 20:37:46 +0200 Subject: [PATCH] fixed history timestamps (uint64_t instead of uint32_t) --- src/mining_nerdnos.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mining_nerdnos.cpp b/src/mining_nerdnos.cpp index 290e4b8..38f815f 100644 --- a/src/mining_nerdnos.cpp +++ b/src/mining_nerdnos.cpp @@ -40,7 +40,7 @@ static bm_job_t asic_jobs[ASIC_JOB_COUNT] = {0}; typedef struct { uint32_t diffs[ASIC_HISTORY_SIZE]; - uint32_t timestamps[ASIC_HISTORY_SIZE]; + uint64_t timestamps[ASIC_HISTORY_SIZE]; uint32_t newest; uint32_t oldest; uint64_t sum; @@ -78,7 +78,7 @@ static void calculate_hashrate(history_t *history, uint32_t diff) { history->diffs[history->newest % ASIC_HISTORY_SIZE] = diff; // micros() wraps around after about 71.58min because it's 32bit casted from 64bit timer :facepalm: - history->timestamps[history->newest % ASIC_HISTORY_SIZE] = esp_timer_get_time(); + history->timestamps[history->newest % ASIC_HISTORY_SIZE] = (uint64_t) esp_timer_get_time(); uint64_t oldest_timestamp = history->timestamps[history->oldest % ASIC_HISTORY_SIZE]; uint64_t newest_timestamp = history->timestamps[history->newest % ASIC_HISTORY_SIZE];