Nmap Development mailing list archives
Re: [PATCH] Pcap recv time for NSE scripts, qscan.nse update
From: Kris Katterjohn <katterjohn () gmail com>
Date: Fri, 23 Jul 2010 05:45:12 -0500
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 07/22/2010 09:50 AM, David Fifield wrote:
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.
Indeed. Any plans for creating a new clock() function? I'm not sure what to do with clock_ms() other than mark it deprecated or something equally lame. It could be cool for a new clock() function to support an optional argument for a time specifier like "s" for seconds, "ms" for msecs and (I guess) "us" for usecs. I doubt clock() would need anything larger than "s" like the other formats Nmap uses. Or at least have a stdnse function for keeping the converting out of scripts, kinda like parse_timespec(). However it's done, it would be cool for qscan.nse to support microsecond resolution.
So I suggest that the pcap receive time be returned as a floating-point number, e.g., 1279810156.6926651.
Sounds fine to me. I've gone ahead and committed this (including luadoc updates) in r19155.
David Fifield
Cheers, Kris Katterjohn -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJMSXK3AAoJEEQxgFs5kUfucDwP/1uPsHXRnd7GzC5C9s00wP1K j4OINokh/tofraXM6csH1YytV5TciFq3HJ74Xv/I1BwoCBUzh3oTnUeZ4J3I768O 72w6UnjlmsHXhYhVaJURQFZpem+ZgNP8Gdeub8V6aE10N/K92xQJAMGeI05Tyaj3 794RzPZFCXy1aVPfY6uHR3rosEZaHsXC1PB8FLziiW0jnXxi6ShcX+eOOBbi5ofu aC/N7orSA+Q9jzFZBaFIu3Q4nmygXC78ReGCizSJRf3nPazK5sCn0zhK7Fkdkajl 6Gpzjx/PaXgK/8TdZ0iBqs6DEmXVSWgg163tFHwVsi3Pc4jdj4r7dE/Q7mgVr21o Bla4PXrhlABU66UT+Zm4/PWh6r8fle09LC80G6EepGvrLtqi/+LzH/28JRItiyue zwXpGayVOnJ5xdjQvm0dHEvbbxfG0rLNntOxfXPxSX0hvhypeUnESJ7cgbeU0slu BMYJ/GPaRntygNqVpAL8fvUR/L7IE5lqvFelPcun9rN7EmR/hc9OND/WP/qw6QQv nsWUuES/QiKlEU+N1/bKSfVUBzdAZU6vU53mKdaQPJIeSTT4dSkFpQ885ZSX9zwJ AIXPcVLL9UmiSTKCs20e++FjrOMvUyMADO1w4PfaS2mEhKpjiREyTc5hjWxrEi6h EYX6EpEB0p10V2HHsFF4 =eAQJ -----END PGP SIGNATURE----- _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/
Current thread:
- [PATCH] Pcap recv time for NSE scripts, qscan.nse update Kris Katterjohn (Jul 21)
- Re: [PATCH] Pcap recv time for NSE scripts, qscan.nse update majek04 (Jul 22)
- Re: [PATCH] Pcap recv time for NSE scripts, qscan.nse update Kris Katterjohn (Jul 23)
- Re: [PATCH] Pcap recv time for NSE scripts, qscan.nse update David Fifield (Jul 22)
- Re: [PATCH] Pcap recv time for NSE scripts, qscan.nse update Kris Katterjohn (Jul 23)
- Re: [PATCH] Pcap recv time for NSE scripts, qscan.nse update David Fifield (Jul 23)
- Re: [PATCH] Pcap recv time for NSE scripts, qscan.nse update Kris Katterjohn (Jul 23)
- Re: [PATCH] Pcap recv time for NSE scripts, qscan.nse update Kris Katterjohn (Jul 23)
- Re: [PATCH] Pcap recv time for NSE scripts, qscan.nse update majek04 (Jul 22)