[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Happy New Almost-Millenium




On 1 January 2000, John Corey wrote:
>> Wondering about the websites reported as displaying
>> the year 19100 (US Naval Observatory among them).
>> Wouldn't working from a four digit number have been
>> easier from a programming standpoint anyway?
>
> Well, the localtime() function returns a struct, where
> the year is the number of years since 1900.  Some people
> don't get it, and prefix the characters '1' and '9' in front
> of that, rather than doing the proper thing, adding the
> number 1900.  It's a bug that's been in hiding in their
> code for the last 100 years .. or so. :)

And I forgot for a moment that Perl doesn't hassle about
type between integer values and strings--I think of that
as an advantage, but makes the above much easier to do.

Forgot such an essential because Python has all my
attention lately.  Returning the date there looks like:

import time
time.asctime(time.localtime(time.time()))

Returning a string like 'Sat Jan  1 16:22:02 2000'

At bottom of the conversion functions is time.time()
which, on a UN*X system, returns a float of seconds
elapsed since 1 January 1970.  Not 2038 compatible,
but precisely for the same reason UN*X isn't.

Speaking of which, does anyone know the exact date
and time when the UN*X apocalypse would occur?


--
To unsubscribe, send email to majordomo@luci.org with
"unsubscribe luci-discuss" in the body.