From 6c9eb0e0f9c4836159d337bf0ff2f7bbdef16e28 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 29 Mar 2019 07:46:06 -1100 Subject: [PATCH] Dailyfx every 5 hours -> on average -> 2 hours ave delay --- src/komodo_gateway.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index cb0bc761b..94f85531a 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1993,7 +1993,7 @@ int32_t get_btcusd(uint32_t pricebits[4]) void komodo_cbopretupdate() { - static uint32_t counter; + static uint32_t lasttime; static uint32_t pricebits[4],cryptoprices[sizeof(Cryptos)/sizeof(*Cryptos)],forexprices[sizeof(Forex)/sizeof(*Forex)]; int32_t size; if ( (ASSETCHAINS_CBOPRET & 1) != 0 ) @@ -2014,10 +2014,11 @@ void komodo_cbopretupdate() } if ( (ASSETCHAINS_CBOPRET & 2) != 0 ) { - if ( (counter % 300) == 0 || forexprices[0] == 0 ) + if ( time(NULL) > lasttime+3600*5 || forexprices[0] == 0 ) { get_dailyfx(forexprices); memcpy(&Mineropret.data()[size],forexprices,sizeof(forexprices)); + lasttime = (uint32_t)time(NULL); } size += sizeof(forexprices); }