r23044 - gnucash/trunk/src/engine - Introduce transaction setter xaccTransSetDatePostedSecsNormalized() that ignores the time-of-day part.

Christian Stimming christian at cstimming.de
Thu Jun 13 03:35:12 EDT 2013

Am Montag, 10. Juni 2013, 18:02:46 schrieb Derek Atkins:
> Christian Stimming <cstim at code.gnucash.org> writes:
> > Author: cstim
> > Date: 2013-06-09 17:32:06 -0400 (Sun, 09 Jun 2013)
> > New Revision: 23044
> > Trac: http://svn.gnucash.org/trac/changeset/23044
> > 
> > Modified:
> >    gnucash/trunk/src/engine/Transaction.c
> >    gnucash/trunk/src/engine/Transaction.h
> > 
> > Log:
> > Introduce transaction setter xaccTransSetDatePostedSecsNormalized() that
> > ignores the time-of-day part.
> > 
> > We've struggled with the time-of-day part of the PostedDate for long
> > enough. The PostedDate field is just not meaningful with anything else
> > but a plain date, and no time-of-day at all. Hence, the correct setter
> > function for this particular field must ignore the time-of-day.
> > Consequently, a GDate should be used here anyway, but in many places
> > the time64 is more convenient. The new function will now redirect that
> > time64 to the GDate setter function to make sure we will now map
> > everything to one single date.
> I'll note that the Close Book transactions depend on being able to say
> +1second to the "canonical" date/time..

Right, I didn't know about that. I've switched back the book-closing date to 
the original setter just a minute ago. From src/gnome-utils/dialog-book-
close.c:294, it's not +1 second but +12 hours, but yes, you are right.

However, this is a perfect example to demonstrate that this usage of 
PostedDate time-of-day part is not so good. Up until now, some of the 
importers already set the time-of-day part, so their sorting might already be 
totally off, compared to the book-closing txn. Effectively, the +12hours 
offset in the PostedDate is being abused to signal the flag "This txn is a 
book-closing txn". Instead of abusing the PostedDate for this, the flag should 
rather be made explicit, which of course means that the sorting functions must 
check for this explicitly as well. Oh well.



More information about the gnucash-devel mailing list