mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 15:39:33 +00:00
Cleanup format_utils.formatPastEpochShort
This commit is contained in:
parent
0fd90864bf
commit
5cc5ee1665
2 changed files with 9 additions and 12 deletions
|
|
@ -245,22 +245,19 @@ function format_utils.formatEpoch(epoch, full_time)
|
|||
end
|
||||
end
|
||||
|
||||
-- shorten an epoch when there is a well defined interval
|
||||
function format_utils.formatEpochShort(epoch_begin, epoch_end, epoch)
|
||||
local begin_day = os.date("!%d", (epoch_begin or os.time()) + getFrontendTzSeconds())
|
||||
local end_day = os.date("!%d", (epoch_end or os.time()) + getFrontendTzSeconds())
|
||||
function format_utils.formatPastEpochShort(input_epoch)
|
||||
local epoch_now = os.time()
|
||||
local epoch = input_epoch or epoch_now
|
||||
local day = os.date("!%d", epoch + getFrontendTzSeconds())
|
||||
local day_now = os.date("!%d", epoch_now + getFrontendTzSeconds())
|
||||
|
||||
if begin_day == end_day then
|
||||
return os.date("!%X", (epoch or os.time()) + getFrontendTzSeconds())
|
||||
if day == day_now then
|
||||
return os.date("!%X", epoch + getFrontendTzSeconds())
|
||||
end
|
||||
|
||||
return format_utils.formatEpoch(epoch)
|
||||
end
|
||||
|
||||
function format_utils.formatPastEpochShort(epoch)
|
||||
return format_utils.formatEpochShort(epoch, os.time(), epoch)
|
||||
end
|
||||
|
||||
-- See also format_utils.msToTime
|
||||
function format_utils.formatMillis(x)
|
||||
if(x == 0) then return 0 end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue