This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

[LUA] Displaying an int64 as human readable timestamp

0

Hi, within my protocol I have an 8 byte value, int64, which contains the number of microseconds since the epoch. What I would like to do is place this into the tree in a human readable format but I'm struggling.

This is what I use to display the value of the int64. msg_header:add(buf(12,8),"Timestamp: " .. buf(12,8):le_int64())

Help would be much appreciated.

Thanks, Bart

asked 01 Apr '16, 05:27

sbart's gravatar image

sbart
6112
accept rate: 0%


One Answer:

0

Found my own answer.

msg_header:add(buf(12,8),"Timestamp: " .. os.date("%x %X",(buf(12,8):le_int64()):tonumber()/1000000) .. "." .. (buf(12,8):le_int64()):tonumber()%1000000)

answered 01 Apr '16, 08:46

sbart's gravatar image

sbart
6112
accept rate: 0%