Nmap Development mailing list archives
Re: A sleep function for NSE
From: jah <jah () zadkiel plus com>
Date: Fri, 20 Feb 2009 21:26:07 +0000
On 20/02/2009 18:55, David Fifield wrote:
A function called "sleep" normally takes an argument in seconds, even if it only provides integer precision. So if the function changes to take milliseconds its name has to change too. In the name of consistency, I think there are only two choices: sleep taking a floating-point number of seconds, or sleep_ms taking an integer number of milliseconds. My preference would be to have sleep take floating-point seconds, and to change nmap.clock_ms and nmap.set_timeout to deal in seconds also. The settimeout in Python does it in seconds: http://docs.python.org/library/socket.html#socket.socket.settimeout Furthermore, clock_ms should be renamed "time" because it is more like the time function in C or os.time in Lua (seconds since 1970) than it is the C clock function (time since some arbitrary point in arbitrary units). clock_ms is doubly frustrating because it uses gettimeofday, which provides microsecond precision, then purposely degrades the result to return milliseconds. It may be too late for nmap.set_timeout because that would be an incompatible change. nmap.clock_ms is easier because it is currently hardly used and its name should change anyway. Any thoughts?
Yeah, tricky. As you (and Arturo) point out, sleep() normally takes seconds and it would be daft to stray from the norm without compelling reasons to do so. If it's a lot of work to change set_timeout to seconds then we probably shouldn't - it's only a small detail after all and the function is well documented and probably fixed in people's minds by now. I agree with the name change for clock_ms, but are you suggesting changing it to accept seconds or to return microseconds? It might be useful to have a fine-grained measurement of time - Doug's Qscan implemented as a script springs to mind. jah _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- A sleep function for NSE David Fifield (Feb 18)
- Re: A sleep function for NSE Ron (Feb 18)
- Re: A sleep function for NSE David Fifield (Feb 18)
- Re: A sleep function for NSE Ron (Feb 18)
- Re: A sleep function for NSE David Fifield (Feb 18)
- Re: A sleep function for NSE jah (Feb 18)
- Re: A sleep function for NSE Arturo 'Buanzo' Busleiman (Feb 18)
- Re: A sleep function for NSE David Fifield (Feb 20)
- Re: A sleep function for NSE Ron (Feb 20)
- Re: A sleep function for NSE jah (Feb 20)
- Re: A sleep function for NSE David Fifield (Feb 20)
- Re: A sleep function for NSE Ron (Feb 18)
- Re: A sleep function for NSE David Fifield (Feb 23)