>From 0eee72d26d06d7087d5d83efbc37564f67489019 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini
Date: Wed, 16 Jan 2013 19:27:20 +0100 Subject: [PATCH] remove need for glib 2.26 --- configure | 2 +- configure.in | 2 +- gsf/gsf-timestamp.c | 16 +++++++++------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/configure b/configure index 30aa84d..029f5f9 100755 --- a/configure +++ b/configure @@ -12740,7 +12740,7 @@ _ACEOF libgsf_reqs=" gobject-2.0 >= 2.16.0 - glib-2.0 >= 2.26.0 + glib-2.0 >= 2.22.0 libxml-2.0 >= 2.4.16 " diff --git a/configure.in b/configure.in index a830360..c6c7254 100644 --- a/configure.in +++ b/configure.in @@ -71,7 +71,7 @@ ifelse([ dnl Modules required for libgsf libgsf_reqs=" gobject-2.0 >= 2.16.0 - glib-2.0 >= 2.26.0 + glib-2.0 >= 2.22.0 libxml-2.0 >= 2.4.16 " diff --git a/gsf/gsf-timestamp.c b/gsf/gsf-timestamp.c index 9d45f9a..a8e0a44 100644 --- a/gsf/gsf-timestamp.c +++ b/gsf/gsf-timestamp.c @@ -136,20 +136,22 @@ int gsf_timestamp_load_from_string (GsfTimestamp *stamp, char const *spec) { int year, month, day, hour, minute, second; - GDateTime *dt; + time_t t; /* 'YYYY-MM-DDThh:mm:ss' */ if (6 != sscanf (spec, "%d-%d-%dT%d:%d:%d", &year, &month, &day, &hour, &minute, &second)) return FALSE; - dt = g_date_time_new_utc (year, month, day, hour, minute, second); - if (!dt) - return FALSE; - - stamp->timet = g_date_time_to_unix (dt); + if (month < 3) { + month += 12; + year--; + } + t = 86400ULL * (day + (153 * month - 457) / 5 + 365 * year + year / 4 - year / 100 + + year / 400 - 719469); + t += 3600 * hour + 60 * minute + second; - g_date_time_unref (dt); + stamp->timet = t; return TRUE; } -- 1.7.1