chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] time->string


From: John Cowan
Subject: Re: [Chicken-hackers] time->string
Date: Sat, 19 Jan 2008 13:59:18 -0500
User-agent: Mutt/1.5.13 (2006-08-11)

felix winkelmann scripsit:

> I'm normally rather reluctant to make backwards-incompatible changes
> (do I hear someone laugh there in the audience?), but since a new
> major release is due, and we have branched the repository for exactly
> these kind of changes we might as well do it now.

IMAO, asctime(3) is complete garbage: the fields are output in a
meaningless order (weekday, month, day, hours, minutes, seconds, year),
there is no indication of timezone, and the result is not even properly
localized.  The newline is just the maraschino cherry on top of this
disgusting mess.  Even Posix says it is only included for backwards
compatibility.

Instead, I suggest making time->string return an ISO 8601 time string of
the form "yyyy-mm-ddThh:mm:ss+zzzz", where the T is literal and + means +
or - as the case may be.  The zzzz value can be found by calling tzset()
and examining the external C variable "timezone" declared in <tzset.h>,
but the value must be negated as the sign is wrong.

This may break applications, but at least it will break them in the
direction of standards and common sense.

-- 
John Cowan  address@hidden  http://ccil.org/~cowan
The penguin geeks is happy / As under the waves they lark
The closed-source geeks ain't happy / They sad cause they in the dark
But geeks in the dark is lucky / They in for a worser treat
One day when the Borg go belly-up / Guess who wind up on the street.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]