[PATCH] Planner: use time.h and utc_mktime() to retrive the current time (no TZ)
Lubomir I. Ivanov
neolit123 at gmail.com
Wed Feb 27 09:43:18 PST 2013
From: "Lubomir I. Ivanov" <neolit123 at gmail.com>
This should do the same as the GTimeZone variant.
Also works on Windows.
Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
---
planner.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/planner.c b/planner.c
index 2e6b920..b6c4d52 100644
--- a/planner.c
+++ b/planner.c
@@ -1123,12 +1123,9 @@ static gboolean po2_focus_out_cb(GtkWidget *entry, GdkEvent * event, gpointer da
* time in that way we actually need to add the timezone offset */
static timestamp_t current_time_notz(void)
{
- timestamp_t now = time(NULL);
- GTimeZone *tz = g_time_zone_new_local();
- gint interval = g_time_zone_find_interval(tz, G_TIME_TYPE_UNIVERSAL, now);
- gint32 offset = g_time_zone_get_offset(tz, interval);
- g_time_zone_unref(tz);
- return now + offset;
+ time_t now = time(NULL);
+ struct tm *local = localtime(&now);
+ return utc_mktime(local);
}
static gboolean starttime_focus_out_cb(GtkWidget *entry, GdkEvent * event, gpointer data)
--
1.7.11.msysgit.0
More information about the subsurface
mailing list