Skip to content

Commit e20c7ad

Browse files
committed
milliseconds
1 parent 6d73474 commit e20c7ad

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

lua/fittencode/log.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ local function get_level_name(level)
2929
return LOG_LEVEL_NAMES[level + 1] or 'UNKNOWN'
3030
end
3131

32-
local function get_ns_time()
32+
local function get_milliseconds()
3333
local sec, usec = vim.uv.gettimeofday()
3434
if sec == nil then
35-
usec = 0
35+
return 0
3636
end
37-
return usec * 1000
37+
return math.floor(usec / 1000)
3838
end
3939

4040
local function format_timestamp()
41-
local ns = string.format('%09d', get_ns_time())
41+
local ns = string.format('%03d', get_milliseconds())
4242
local date = os.date('%Y-%m-%dT%H:%M:%S')
4343
-- +0800 -> +08:00
4444
local timezone = tostring(os.date('%z'))

0 commit comments

Comments
 (0)