Home page logo

nmap-dev logo Nmap Development mailing list archives

Re: [NSE] ip-geolocation
From: Gorjan Petrovski <mogi57 () gmail com>
Date: Fri, 17 Jun 2011 20:18:33 +0200

I think it's because of the difference between GMT and UTC, and my
clock was badly synchronized. Btw, anyone could run into this kind of
problem when using the script. Makes me think I should get the time
from a NTP server and not locally. We're already using a public web
service in this script so we can assume the user has Internet
connectivity. What do you think about that?

On Fri, Jun 17, 2011 at 5:52 PM, Patrick Donnelly <batrick () batbytes com> wrote:
On Fri, Jun 17, 2011 at 7:48 AM, Gorjan Petrovski <mogi57 () gmail com> wrote:
Well it seems there is some kind of a problem with the os.time()
function when a table is passed to it. The result is one hour less
than it should be (one hour less than the time in the table supplied).

Should I leave the gmtime() function in place and commit the script as is?

Should I diagnose and fix the problem with the os.time() function or
should I leave that to the bug wranglers?

Are you taking daylight savings time into account?

Also, I just wrote a quick test and Lua seems to be working correctly:

batrick () neverwinter:~$ ./a.out ; lua -e 'print(os.time(os.date "!*t"))'
local time: 1308325658
UTC time: 1308343658
batrick () neverwinter:~$ cat utc.c
#include <time.h>

int main (int argc, char *argv[])
 time_t now = time(NULL);
 printf("local time: %llu\n", (long long unsigned) now);
 now = mktime(gmtime(&now));
 printf("UTC time: %llu\n", (long long unsigned) now);
 return 0;
batrick () neverwinter:~$ gcc utc.c
utc.c: In function ‘main’:
utc.c:6:3: warning: incompatible implicit declaration of built-in
function ‘printf’
batrick () neverwinter:~$ ./a.out ; lua -e 'print(os.time(os.date "!*t"))'
local time: 1308325923
UTC time: 1308343923

- Patrick Donnelly

Sent through the nmap-dev mailing list
Archived at http://seclists.org/nmap-dev/

  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]