jck has asked for the wisdom of the Perl Monks concerning the following question:

i'm implementing code that i had on one server onto a new server (hosted by HiVelocity), and i'm perplexed by the following:

using localtime function, the value that is returned for current time is approximately 18 minutes and 10 seconds behind my actual local time (EST).

does anyone know why this should be the case, and how i can compensate for this discrepancy in my code?

thanks, janaki

Replies are listed 'Best First'.
Re: localtime off?
by roboticus (Chancellor) on Jun 09, 2006 at 03:55 UTC
    jck:

    Perhaps the server just isn't sync'ed to a time standard? A phone call might get them to fix the time. If not, you could always write a subroutine that you use to get the time, like:

    sub fixtime { # Server is off by 18:10! my $TimeOffset = 18*60 + 10; return time + $TimeOffset; }
    Then you can call fixtime instead of time whenever you need it. If the server drifts further, you'll have to update the value of $TimeOffset, though...

    --roboticus

Re: localtime off?
by davido (Cardinal) on Jun 09, 2006 at 03:56 UTC

    This may seem somewhat along the lines of a tech support dude saying, "Um, is it plugged in?", but here goes anyway:

    Um, is the system's clock accurate?

    If you type date at the command prompt (assuming a unix or linux system) is it also off by 18 minutes and 10 seconds?


    Dave

      well, thanks all, for the quick replies!! i had figured that it was probably a problem at the server end........i had just never encountered this before (spoiled, i guess).

      just was wondering if i was overlooking something stupid.

      thanks for reassuring me! jck