in reply to Remote File - Last Modification Time

I see three solutions, in order of knowlege of the server required:

1: Take all times mod. one hour -- that is, compare based only on minutes and seconds. This will give odd results fairly often -- use it only if you know you'll be running often.

2: Put the offset from GMT (or your localtime) in a config file for each server.

3: Create a file on the server, then use it's time as your "now".

Hm, I just thought of a number four: if the server also has a HTTP server on it, send a request, and guess off of the Date: header returned. That is, of course, rather fragile, but it's better then nothing.


Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

  • Comment on Re: Remote File - Last Modification Time

Replies are listed 'Best First'.
Re: Re: Remote File - Last Modification Time
by pfaut (Priest) on Jan 05, 2003 at 16:18 UTC

    I would try the daytime (13/tcp) service before attempting to hit a web server. Web services are likely to be proxied.

    $ telnet xxx daytime Trying 192.168.80.3... Connected to xxx. Escape character is '^]'. 05 JAN 2003 11:16:39 EST Connection closed by foreign host.
    --- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';