From 4b51f0f235d7a7855b36e4fa61cdb73c7243d3e5 Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Sun, 16 Jan 2022 10:50:08 +0100 Subject: [PATCH] Only update exchange rate once per day --- src/entsoe/EntsoeApi.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/entsoe/EntsoeApi.cpp b/src/entsoe/EntsoeApi.cpp index 02eba76f..0994bb3f 100644 --- a/src/entsoe/EntsoeApi.cpp +++ b/src/entsoe/EntsoeApi.cpp @@ -265,7 +265,7 @@ float EntsoeApi::getCurrencyMultiplier(const char* from, const char* to) { return 1.00; uint64_t now = millis64(); - if(lastCurrencyFetch == 0 || lastCurrencyFetch < midnightMillis) { + if(lastCurrencyFetch < midnightMillis) { char url[256]; DnbCurrParser p; @@ -292,7 +292,7 @@ float EntsoeApi::getCurrencyMultiplier(const char* from, const char* to) { } } if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf("(EntsoeApi) Resulting currency multiplier: %.4f\n", currencyMultiplier); - lastCurrencyFetch = now; + lastCurrencyFetch = midnightMillis; } return currencyMultiplier; }