From d82e705875ec761db87c66ce035540b89f64eb09 Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Wed, 1 Nov 2023 21:48:44 +0100 Subject: [PATCH] Ensure that the default 1.0 multiplier for currency is not used --- lib/EntsoePriceApi/src/EntsoeApi.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/EntsoePriceApi/src/EntsoeApi.cpp b/lib/EntsoePriceApi/src/EntsoeApi.cpp index 165b2473..0809e114 100644 --- a/lib/EntsoePriceApi/src/EntsoeApi.cpp +++ b/lib/EntsoePriceApi/src/EntsoeApi.cpp @@ -286,16 +286,18 @@ float EntsoeApi::getCurrencyMultiplier(const char* from, const char* to, time_t if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("(EntsoeApi) got exchange rate %.4f\n"), p.getValue()); currencyMultiplier /= p.getValue(); } else { + currencyMultiplier = 0; return 0; } } } else { + currencyMultiplier = 0; return 0; } if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("(EntsoeApi) Resulting currency multiplier: %.4f\n"), currencyMultiplier); tmElements_t tm; breakTime(t, tm); - lastCurrencyFetch = now + (SECS_PER_DAY * 1000) - (((((tm.Hour * 60) + tm.Minute) * 60) + tm.Second) * 1000); + lastCurrencyFetch = now + (SECS_PER_DAY * 1000) - (((((tm.Hour * 60) + tm.Minute) * 60) + tm.Second) * 1000) + 3600000; } return currencyMultiplier; }