Wireshark mailing list archives

Re: Can't get nsecs info form lua srcript ?


From: Guy Harris <guy () alum mit edu>
Date: Thu, 20 Nov 2014 11:49:11 -0800


On Nov 20, 2014, at 8:07 AM, 徐鸿 <icehong () gmail com> wrote:

Is it possible to get  accurate nanosecond info for lua script ?   For the same packet , I got pinfo.abs_ts == 
1416493696.7953 in lua script  , but in main window the time show as "1416493696.795345000",    is it possible to got 
 the accurate nanosecond in lua ?

1416493696.795345000 is either, by happenstance, an exact multiple of 1000 nanoseconds, i.e. 1 microsecond, or has only 
microsecond precision.  Most time stamping in the capture mechanisms used by Wireshark has microsecond precision, not 
nanosecond precision.

The Wireshark code in

my wireshark version is Version 1.12.2 (v1.12.2-0-g898fa22 from master-1.12) Running on 64-bit Windows 7 Service Pack 
1, build 7601

1.12.2 that gets the time appears to do a floating-point calculation that *should* provide the full resolution.  If the 
Lua in the Windows version is built with lua_Number being a double, which I think is the default, that *should* be 
sufficient to  hold a value of 1416493696.795345 with full precision.

How are you displaying the value in your Lua script?  Perhaps it's getting the time stamp with full precision but, for 
some reason, it's not displaying it with full precision?
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

Current thread: