time_t

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


On Mon, 14 Jul 2008, Charles Day wrote:

> Yes, considering that some folks have mortgage payments spread over 30
> years, i.e. through 2038. So to some degree, time_t will be obsolete 6
> months from now. There has been talk of 50 year mortgages in the U.S., and
> these may already be available elsewhere.
>
>> Why use a time stamp?  My companies' accounting system uses a 32-bit dayno
>
> Time of day is important in some areas, such as price quotes (or at least it
> should be), so if there is any change at all then I would think using a
> wider type makes more sense than dropping time of day.

Computing days between timestamps (and converting timestamps to/from dates)
is non-trivial.  1) You have to normalize to some kind of end of business day.
2) The number of seconds in a day varies, so you can't just divide by 24*60*60.
ST/DT transistions add or subtract between 1/2 hour and 2 hours depending on
locale.  Leap seconds add or subtract seconds.

In fact, the simplest way to handle normal accounting with timestamps is
to convert to an accounting dayno or mdy.  Details of the conversion,
such as locale and boundary between business days are preferences.

Most accounting functions are vastly simpler with dates rather than
timestamps.  That is why we went with two different types for dates 
vs. timestamps.  We use 64-bit signed milliseconds since 1970 for
timestamps, just like Java.

-- 
 	      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