[EMAIL PROTECTED] wrote:

> my $next_day=localtime(time+(60*60*24));
> print "tomorrow is $next_day\n";
...

> mine uses the built-ins time() and localtime()
> 
> time() returns seconds since 1/1/1970 (epoch) and localtime() gives you a 
> human readable date.
> 
> what i do is seed localtime with the current epoch, with 60 (seconds) 
> times 60 (minutes) times 24 (hours) to advance it one full day.

I sent an old one originally which I later corrected.  The problem
comes on time changes and weird situations like that which is why I
shifted the time back to noon to avoid any DST problems.

my @t = localtime;                      # get epoch time for today
$t[0] = 0; $t[1] = 0; $t[2] = 12;       # drop H:M:S back to noon
my $time = timelocal (@t) + 86400;      # convert to epoch time and add a day

You could turn that into a one liner, but I wouldn't.  ;)

> thus every time you run it, it gives you tomorrow to the second it was 
> run.
> 
> If you are looking for something that could be puzzling on upkeep if 
> you're not an oddball like myself, yet completely portable, use my 
> solution.
> If you want something friendly to upkeep, use Bill's.

-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to