From 9b12c0bb086beee467bffd425ca62c2e0ef2c038 Mon Sep 17 00:00:00 2001 From: Manuel Simon Hirsig Date: Fri, 12 Feb 2016 03:21:13 +0100 Subject: [PATCH] changed push time from 17 hours after the last push to always midnight local time --- history.lua | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/history.lua b/history.lua index 4675fe1..bbd4194 100644 --- a/history.lua +++ b/history.lua @@ -1,18 +1,14 @@ local private, public = {}, {} Aux.history = public -private.PUSH_INTERVAL = 57600 - -function private.hours_left_in_day() - return 24 - tonumber(date('%H')) -end - -function private.time_until_next_push() - return time() + private.hours_left_in_day * 3600 +function private.next_push() + local date = date('*t') + date.hour, date.min, date.sec = 24, 0, 0 + return time(date) end function private.new_record() - return { next_push = time() + private.PUSH_INTERVAL, market_values = {} } + return { next_push = private.next_push(), market_values = {} } end function private.load_data() @@ -139,5 +135,5 @@ function private.push_record(item_record) item_record.daily_max_bid = nil item_record.daily_min_buyout = nil item_record.daily_max_price = nil - item_record.next_push = time() + private.PUSH_INTERVAL + item_record.next_push = private.next_push() end \ No newline at end of file