I have a Lua script to read a PCAP file. For a packet, I can get its time with the expression
os.date("%Y/%m/%d %X", last_pinfo.abs_ts)
The result is like “2012/05/24 11:32:50”, but I want the result like “May 24, 2012 11:32:50.476690000”. Is that possible?
Lua’s
os.datefollows the same format as C’s strftime function.However, time in standard Lua only goes accurate up to seconds. You’ll have to add the decimal part of the seconds from another source, eg LuaSocket’s
socket.gettime():