http://www.israelnews2.co.il/weather/

this "year 100" problem is most probably the one I fond on my system
too. anyone using the perl timelocal() as directed in the O'Reilly perl
book should be aware:

($sec,$min,$hour,$mday,$month,$year) = localtime(time);
print $year."\n";

you get: 100!

basicly it's a value that was only "useful" as a two digit year in the
20th century, so "$year += 1900" will always be the right year. the
O'Reilly book fails to mention this, but "perldoc -f localtime" will
tell you all about it. Excerpt:

  All array elements are numeric, and come straight out of a struct
  tm. In particular this means that $mon has the range 0..11 and
  $wday has the range 0..6 with sunday as day 0.  Also,
  $year is the number of years since 1900, that is, year is
  123 in year 2023, and _not_ simply the last two digits of the
  year.  If you assume it is, then you create non-Y2K-compliant
  programs--and you wouldn't want to do that, would you?

therefore, your solution is one of three. after you get the year with
($sec,$min,$hour,$mday,$month,$year) = localtime(time);  

you can do one of the following:

$year += 1900;            # get the real year number

$year = $year % 100;      # get the real "years since last beginning of
                          # the century"

$year=substr($year,-2,2); # get a 2-numeral string representing the
                          # year, the way the accountant will be happy.

please publish here more tips and glitches if you find them.


-- 
Ira Abramov ;  whois:IA58  ;  www.scso.com ;  all around Linux enthusiast
Who wants to remember that escape-x-alt-control-left shift-b puts you into
super-edit-debug-compile mode?
(Discussion in comp.os.linux.misc on the intuitiveness of commands, especially
Emacs.)


=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to