What is the origin of the asctime format?
This come directly from C. Probably the year was added later. Also the \n
is strange. Probably a convenience function when building UNIX, and it got standardized by use.
Note: the function is "obsolete", and possibly it will be removed in later version of C. It is replaced by more powerful strftime()
.
POSIX has no rationale about the choice.
ESR wrote:
In older Unixes the following functions were available to report time and date as a string. They wired in bad design choices (the date string is of unpredictable length and includes a trailing "\n"), are not locale-aware, and have undefined behavior for years before 0 or after 9999.
We have also few information from 7th edition of the manual (1979) see manual pages.
Somebody (Clive D.W. Feather) looked for the same information as you (but directly to C standard group), but I do not find the answer. Just that C99 were corrected because some imprecision email on the same thread.
I think it will be difficult to get more information.
It's not a common representation in the US, and the C Rationale even admits as much:
7.11 Localization
....
Date and time. The standard function
asctime
returns a string which includes abbreviations for month and weekday names, and returns the various elements in a format which might be considered unusual even in its country of origin.
In hindsight, it's one of those functions that never should have made it into a Standard. The lack of a Rationale justifying its inclusion is a clear sign of that.