<p>I have a piece of code in ANSI C which uses the time.h library and time_h structures to (amongst other date-related calculations) work out the interval between two given dates. This works fine but this limits my code to input between 1970 and 2038. I would now like to make my code more general.</p>

<p>Is there a common C library (ANSI or C99 standard) which implements date calculations on ranges larger than time.h, on a granularity of 1 day (i.e. I need to-the-day resolution but hour resolution is not necessary)?</p>

<p>(I'm adapting the code to deal with historical events hence it would be nice if it could also deal with dates in B.C. ....)</p>

There's a public domain implementation used in SQLite:
documentation
,
source
I've also found the
Calendar FAQ
useful;
this
page pops up early on Google.