[Bug 34983] Internally use GDateTime for date computation

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Fri Mar 4 05:17:30 CET 2011


https://bugs.freedesktop.org/show_bug.cgi?id=34983

--- Comment #3 from Nicolas Dufresne <nicolas.dufresne at collabora.co.uk> 2011-03-03 20:17:30 PST ---
(In reply to comment #2)
> This looks pretty good.
> 
> I had originally wondered if you should just pass GDateTimes around in the API,
> but then you have to manage their memory which seems like a pain in the neck.

Actually, one of my goal is to replace the gint64 timestamp in TplEvent with a
GDateTime. As GDateTime is immutable and ref-counted, I never have to copy it.
As most operation simply require generating formated strings I don't even have
to reference it. But this requires breaking API, so I decided to do it in two
steps, this is first and second is to actually break the API and integrate it
in future 0.3.X branch.

> 
> The only potential downfall I can see of using gint64s throughout is that you
> could potentially mix up localtime and unix time? You code here looks correct,
> but it's a mistake someone could possibly make in the future? This could
> potentially be mitigated with a TplUnixTimestamp64 typedef, although it then
> requires people to use it and think and understand, so maybe it's not useful.

It's indeed a risk, GDateTime is even a better solution since it abstract the
timezone. Creating TplUnixTimestamp64 does not seem bad, and does not actually
break the API, I'll consider this.

> 
> Does this branch remove all of the time_ts from the API? I thought you'd said
> there were still some left in the public API, but greping didn't find them.

There was no time_t in the public API, but this change removes all use of
time_t in the internal implementation. For 0.3.X I also plan on replacing GDate
with GDateTime in list return by _get_dates() and inside TplSearchHit.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.



More information about the telepathy-bugs mailing list