Timespecs & GDates

Derek Atkins warlord at MIT.EDU
Sun Dec 23 12:05:46 EST 2007


Phil Longstaff <plongstaff at rogers.com> writes:

> Two questions:
>
> 1) Can anyone tell me why gnc_price_set_time() takes a Timespec passed 
> by value but the routines in Transaction.h which take Timespecs are 
> passed by reference?  It would simplify the gda backend if they were 
> always passed the same way (either by value or by reference, but not both).

My guess is that there are different methods due in part to
whether the API was written to be wrapped by g-wrap.  In g-wrap
we had a wrapper around Timespec so that you could use it
directly (instead of as a pointer), which required APIs to
pass in/out by value, not reference.   But yes, it should be
done consistently.   Does it matter to you which way?

> 2) Now that GDates are used, is there any reason that Timespec couldn't 
> be replaced by GDate everywhere?

Other than changing all the APIs everywhere, I don't see any reason
not to migrate, but I'd only migrate as necessary.  Keep in mind that
the Scheme API is derived from the C API so you'd have to go through
all the scheme every time you change a C API to make sure that it
doesn't break anything.

> Phil

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available


More information about the gnucash-devel mailing list