Time64 <> gconf ?
Geert Janssens
janssens-geert at telenet.be
Fri Sep 20 11:30:31 EDT 2013
On Friday 20 September 2013 07:55:44 John Ralls wrote:
> On Sep 20, 2013, at 3:34 AM, Geert Janssens <janssens-geert at telenet.be> 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
More information about the gnucash-devel
mailing list