On Friday 20 September 2013 10:14:08 John Ralls wrote: > On Sep 20, 2013, at 8:30 AM, Geert Janssens <[email protected]> wrote: > > On Friday 20 September 2013 07:55:44 John Ralls wrote: > > > On Sep 20, 2013, at 3:34 AM, Geert Janssens <[email protected]> > > > wrote: > > > > John, > > > > > > > > You have recently done a great job with our time handling code > > > > to > > > > solve the year 38 problem in GnuCash. > > > > > > > > I didn't follow it in all detail, but from what I see you have > > > > switched to using time64 in many locations. > > > > > > > > While converting from gconf to gsettings, I have found that > > > > there > > > > are a few preferences that store time as a 32-bit int. I presume > > > > that should change as well. > > > > > > > > I will fix this for our gsetting backend, but I just wanted to > > > > make > > > > sure I do it correctly. If I store the time preferences as > > > > gint64 > > > > in gsettings will that be sufficient ? > > > > > > Geert, > > > > > > I guess it depends on what kind of time needs to be stored; it > > > might > > > make more sense, particularly if you're just interested in a date > > > rather than a date-time, to store an ISO-8601 string. > > > > I understand your point. > > > > On the other hand I'm working from the existing code. The gconf > > preference is linked to a GncDateEdit widget. This works works with > > date-time values internally, even though GnuCash only uses the date > > part in the gui. If I stick the internally used value, that does > > simplify my porting work a lot, so for now I prefer to simply store > > a time64 in preferences.> > > > If you decide to use a gint64, it's clearer if you call it > > > "time64"; > > > that typedef is in gnc-date.h. > > > > This was already the case in the GncDateEdit code. The code that > > manages the link between the preference dialog and the gconf > > backend however used gnc_gconf_set_int() to store that time64 into > > gconf. That would obviously overflow in 2038. > > > > It's only in that spot that I needed to know the proper way to > > handle value conversion. > > > > There is no gconf function to handle a time64 value, nor is there a > > gsettings function for it. So at the border between gnucash and > > gsettings, I will have to call it int64, but that will only be > > right where the gsettings functions are called. Just before/after > > the value will be converted form/into a time64. > Geert, > > It's a typedef. The compiler should treat time64 and gint64 (and long > long, which is what the C99 standard calls it) interchangeably > without casting. > > There's no g_settings_set_int64(), either. You'll have to use > g_settings_set_variant (g_variant_new_int64 (time)) and deal with the > GVariant's memory yourself on retrieval.
That's indeed the route I took. I realize this wasn't very clear from my previous explanation. But thanks for all the info. That way I'm reassured that what I did is ok. Geert _______________________________________________ gnucash-devel mailing list [email protected] https://lists.gnucash.org/mailman/listinfo/gnucash-devel
