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

This worked for exactly 99 days and I don't know when it died! :( It said 99 days 2 days ago when I first noticed it, but it STILL says 99 days. So it worked until 99, whenever that was exactly. Can someone tell me what's wrong?

This is to count days from Feb 09, 2004.

my $start = timegm(0, 0, 0, 9, 1, 2004); printf "%d", int((timegm(localtime) - $start)/(24*60*60));

Replies are listed 'Best First'.
Re: Days since is broken!
by saintmike (Vicar) on May 19, 2004 at 16:01 UTC
    This works fine for me (given you're using Time::Local). Maybe the clock on your system stalled :) ?
      #!/usr/bin/perl use strict; use warnings; use CGI qw/:standard/; use CGI::Carp 'fatalsToBrowser'; use Time::Local; print header; my $start = timegm(0, 0, 0, 9, 1, 2004); printf "%d", int((timegm(localtime) - $start)/(24*60*60));
      So you don't think it's the code?
        Are you loading from the browser's cache?
Re: Days since is broken!
by idsfa (Vicar) on May 19, 2004 at 16:08 UTC

    Your clock was broken two days ago. Count it out.


    If anyone needs me I'll be in the Angry Dome.