Robert Elz kre at munnari.OZ.AU
Thu Jul 29 18:14:02 UTC 2004

    Date:        Thu, 29 Jul 2004 15:52:46 +0100
    From:        "Clive D.W. Feather" <clive at>
    Message-ID:  <20040729145246.GY34961 at>

  | I don't know the history of the asctime() specification, but I suspect that
  | it has more basis than your claim.

The original asctime() specified exactly what the out buffer would
contain.   Sure, it was never really expecting to be dealing with
years before 1900, but as it always took a struct tm, that was
always possible.

  | People expecting an exact format for the output should be using strftime.

This much I agree with - but that's only rational for code people are
writing (or at least, maintaining) today.   What matters here is old
orphaned code, written 10-20 years ago (or more), that still works.

  | asctime() is a quick-and-dirty interface to produce something that can be
  | output in a log file or similar. It's not intended to be an exact science.

asctime() is a historic interface - no-one would be inventing it today.

When it was created, it was the only time -> printable string routine
around (after asctime() was invented, I vaguely recall that ctime(),
which produces the same output format, predates it - once asctime()
was created, ctime() became its most frequent client, of course).

Now, the only justification really to keep asctime() is for old code
that is using it - and expecting its old interface.

The really poor thing about this, is that the time functions (dst and
zone representations excluded) have been one of the C/unix functions
that have never been subject to the "my version is different than yours"
syndrome that plagued so many of the other interfaces.   There was never
any justification for any changes to this interface.


More information about the tz mailing list