time_t

Stuart D. Gathman stuart at gathman.org
Mon Jul 14 11:07:54 EDT 2008


On Mon, 14 Jul 2008, Martin Preuss wrote:

> Though he currently doesn't need to enter dates which are outside the scope of
> time_t he is curious about the reason of the limitation to time_t instead of
> using another, wider type.
>
> Maybe gnucash lives long enough to exceed the date range offered by time_t and
> then the question might arise again :-)

Indeed, Dec 18, 2038 is coming fast.

Why use a time stamp?  My companies' accounting system uses a 32-bit day no -
days since the Jewish/Christian traditional creation in 4012 BC (Julian day).
Most accounting computations deal with days between dates (subtract)
or day of the week (modulo 7).  Functions like "last day of month" are
trivial with dayno->mdy and mdy->dayno conversions.  Conversion to/from
month,day,year is small and simple for Gregorian Calendar (code on request).
Other calendars are just as easy and earn Geek points.

If there is some module that requires actual timestamps (say pickup and
delivery tracking), it can store a wider type, or tack-on a timeofday field.

-- 
 	      Stuart D. Gathman <stuart at bmsi.com>
Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flamis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.


More information about the gnucash-devel mailing list