mirror of
https://github.com/nmap/nmap.git
synced 2025-12-24 08:29:04 +00:00
Change o.TimeSinceStartMS returning milliseconds to o.TimeSinceStart
returning floating-point seconds. Everywhere o.TimeSinceStartMS was called, the return value was being divided by 1000.0, which had the same effect but would overflow when the difference exceeded about 25 days (2^31 milliseconds). This patch is by Daniel Miller.
This commit is contained in:
@@ -155,15 +155,15 @@ const struct in_addr *NmapOps::v4sourceip() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Number of milliseconds since getStartTime(). The current time is an
|
||||
// Number of seconds since getStartTime(). The current time is an
|
||||
// optional argument to avoid an extra gettimeofday() call.
|
||||
int NmapOps::TimeSinceStartMS(const struct timeval *now) {
|
||||
float NmapOps::TimeSinceStart(const struct timeval *now) {
|
||||
struct timeval tv;
|
||||
if (!now)
|
||||
gettimeofday(&tv, NULL);
|
||||
else tv = *now;
|
||||
|
||||
return TIMEVAL_MSEC_SUBTRACT(tv, start_time);
|
||||
return TIMEVAL_FSEC_SUBTRACT(tv, start_time);
|
||||
}
|
||||
|
||||
// Convert a filename to a file:// URL. The return value must be freed.
|
||||
|
||||
Reference in New Issue
Block a user