mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Handle GUI timezone vs backend timezone in interface historical data
This commit is contained in:
parent
e6d615ed91
commit
703b96cf8f
5 changed files with 25 additions and 9 deletions
|
|
@ -2621,6 +2621,7 @@ end
|
|||
|
||||
-- ####################################################
|
||||
|
||||
-- Get the local (backend) timezone offset in seconds
|
||||
function getTzOffsetSeconds()
|
||||
local now = os.time()
|
||||
local local_t = os.date("*t", now)
|
||||
|
|
@ -2645,6 +2646,17 @@ end
|
|||
|
||||
-- ####################################################
|
||||
|
||||
-- Get the delta between the frontend local time and the backend local time in seconds
|
||||
function getFrontendTzDeltaSeconds(frontend_tz_offset)
|
||||
if frontend_tz_offset == nil then
|
||||
return 0
|
||||
end
|
||||
return frontend_tz_offset - getTzOffsetSeconds()
|
||||
end
|
||||
|
||||
-- ####################################################
|
||||
|
||||
-- Converts a string (with the timezone offset) into an epoch
|
||||
function makeTimeStamp(d, tzoffset)
|
||||
-- tzoffset is the timezone difference between UTC and Local Time in the browser
|
||||
local pattern = "(%d+)%/(%d+)%/(%d+) (%d+):(%d+):(%d+)"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue