GDateTime appears to be a component of the Gnome Library (GLib). As documented in GLib, GDateTime is a structure (and set of methods) for working with date/time data, capable of representing (with microsecond precision) any date/time from 0001-01-01 00:00:00
to 9999-12-31 23:59:59.999999
.
Therefore, if (a) You're already using GLib (or are willing to pull in the entire GLib library just for this one thing), and (b) you need or have a use for the increased range and/or precision provided by GDateTime, then, the advantage of using GDateTime instead of localtime_r is that you have the increased range and/or precision provided by GDateTime.