Strftime's %C and %y formats versus wide-ranging tm_year valu es

Olson, Arthur David (NIH/NCI) olsona at dc37a.nci.nih.gov
Tue Sep 28 13:27:20 UTC 2004


Another way to avoid problems with really big tm_year values would be to
have something such as...

	#if (sizeof long) > (sizeof int)
	typedef long		raw_year_type;
	#else
	typedef long long		raw_year_type;
	#endif

...in the tzfile.h header file and then use the defined type for variables
that hold results such as tmp->tm_year + TM_YEAR_BASE.
It certainly makes for shorter code; as for the relative efficiency of long
long arithmetic versus doubling the number of % operations being done,
deponent sayeth not.

				--ado



More information about the tz mailing list