Email address obfuscation in effect -- please
click here to turn it off.
[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
TAKE_ME_OFF_THIS_GOD_DAMN_LIST_!!!
i've asked nice several times to both names listed on the FAQ page, and i
still get the members digest and all other postings. i get about 50 e-mails
a day, and never even use my linux box.
-peter kwentus
At 09:19 AM 1/5/00 -0600, you wrote:
>I've also noticed on an accounting system I wrote that the POSIX::strftime
>function expects the output from localtime. So, if you add 1900 to the
>year you get from localtime, you get something like the year 3900 in your
>output. So, if you use strftime make sure you add 1900 after the strftime
>function call. Alternately, you could use two variables, one with the
>date as 100 and the other with the date as 2000 to fix your problem (damn,
>now I've got to go back and change my code *again*).
>
>Dave Lloyd
>
>On Wed, 5 Jan 2000, Mark Donnelly wrote:
>
>> >From http://www.perl.com/pub/1999/01/y2k.html, written by Tom
>> Christiansen:
>>
>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>> The date and time functions supplied with Perl are the gmtime() and
>> localtime() functions, which are derived from their namesakes from the C
>> programming language. These supply adequate information to determine the
>> year well beyond 2000. 2038 is when trouble strikes, but only for those of
>> us still stuck on 32-bit machines, a somewhat unlikely albeit admittedly
>> not entirely unthinkable situation.
>>
>> The year returned by these functions (when used in
>> list context) is, contrary to popular misconception, not by definition a
>> two-digit year. Rather, it merely happens to be such right now. What it
>> actually is, is the current year minus one thousand nine hundred. For
>> years between 1900 and 1999 this happens to be a 2-digit decimal number,
>> but that's not going to last long. To avoid the year 2000 problem, simply
>> do not treat the year as a 2-digit number. Easy to say, and easy to break.
>> Imagine that you want find out what the year appears to be in five years,
>> so you write code like this.
>>
>>
>> use Time::localtime;
>> $then = time() + ( 60 * 60 * 24 * 365 * 5 ); # 5 years from now
>> $that_year = localtime($then) -> year;
>>
>> printf("It shall be 19%d\n", $that_year); # WRONG! 19103
>> printf("It shall be %d\n", 1900 + $that_year); # right: 2003
>>
>>
>>
>>
>
>