Nmap Development mailing list archives

Re: [PATCH] Pcap recv time for NSE scripts, qscan.nse update


From: David Fifield <david () bamsoftware com>
Date: Thu, 22 Jul 2010 08:50:38 -0600

On Wed, Jul 21, 2010 at 08:31:47PM -0500, Kris Katterjohn wrote:
Since the clock_ms() and new pcap time are both using milliseconds, I added a
new TIMEVAL_MSECS() macro to nbase.h for them to share.  This converts a
timeval to milliseconds in unsigned long long format.  This integer type is
used in several other places in the codebase so it should not be a problem,
but do correct me if I'm wrong.  A couple of years ago I fixed a bug in Nmap
by using this type, and I don't recall any difficulty.  clock_ms() was
implemented by casting to lua_Number while converting to msecs, and that's
different than this macro because it's unsigned long long until it's pushed
onto the lua stack as lua_Number.

clock_ms was a mistake. It should have been called simply "clock" and
returned a floating-point number of seconds. It bothers me that clock_ms
deliberately degrades the information it has to provide millisecond
precision.

So I suggest that the pcap receive time be returned as a floating-point
number, e.g., 1279810156.6926651.

David Fifield
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: