#include <sys/time.h>
#include <glib.h>

void
main()
{
    time_t tt, ta;
    struct tm t, tma;
    GDateTime *gd;

    while (TRUE)
    {
        tt = time (NULL);

        gmtime_r (&tt, &t);
        gmtime_r (&tt, &tma);

        gd = g_date_time_new_now_utc ();

        ta = time (NULL);

        if (tt == ta)
        {
            g_assert_cmpint(t.tm_sec, <=, g_date_time_get_second(gd));
        }

        g_date_time_unref (gd);
    }
}
