Some readers may remember that I spent some time working on a DateTime structure for GLib last year. After much refinement by others better than myself, it has been included in GLib master. Much thanks to Thiago Sousa Santos, Emmanuele Bassi, and the countless reviewers.
You can find some quick examples here.
GDateTime is both immutable and reference counted. See gdatetime.h for relevant API.
- GDateTime *dt;
- char *str;
- dt = g_date_time_new_now();
- str = g_date_time_format(dt, "It is currently %x %X %z");
- g_print("%s\n", str);