I got fed up with working around all the limitations with date and time in glib and C (time_t, struct timeval, struct tm, GTimeVal, GDate, etc) so I decided to write something new.

The result is GDateTime. It handles dates and times from 1/1/1 to 12/31/9999 on 100-nanosecond intervals. As requested by a few individuals, it is an opaque/boxed type. String parsing is incomplete but the rest should be in good shape.

The glib branch is available here. Or for those with short attention spans, the header gdatetime.h.

You can even use GDateTimes as keys within a GHashTable using gdatetimehash, gdatetimeequal.

GHashTable *hash;

hash = g_hash_table_new_full (g_date_time_hash,

I'm interested in feedback and patches.

-- Christian Hergert 2009-10-03

Back to Index