Proposed strftime.c changes for long years

Paul Eggert eggert at CS.UCLA.EDU
Thu Sep 9 21:56:44 UTC 2004

"Olson, Arthur David (NIH/NCI)" <olsona at> writes:

> + ** XXX To do: figure out correct (as distinct from standard-mandated)
> + ** output for "two digits of year" and "century" formats when
> + ** the year is negative or less than 100. --ado, 2004-09-09

Hmm, what's the problem for years less than 100?  %C is clearly
zero-origin, since it reports 19 for 1999 and 20 for 2000 (which isn't
the same as "19th century" or "20th century").  So even though the
year 50 is 1st-century, its %C should be 00.

Maybe there's some doubt about the proper value for the year 0 (i.e.,
the year 1 B.C. according to the Venerable Bede's system) but I don't
see any doubt about years 1 through 99.

One other point that might be worth mentioning somewhere: this whole
set of patches is motivated by the common case where time_t and long
are 64 bits and int is 32 bits, but it doesn't suffice for some other
cases, e.g., int==long==32 bits and time_t==64 bits (a case that is
not allowed by C89 but is allowed by C99).  Personally I'm inclined to
not worry about these weird cases unless a real portability problem
arises, just as we currently don't worry about the case where
time_t==float (which the standards have always allowed).

More information about the tz mailing list