[gnome-control-center] datetime: Restore TZ envvar as it was
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] datetime: Restore TZ envvar as it was
- Date: Thu, 14 Jul 2011 10:59:30 +0000 (UTC)
commit 11d94b271b85b6146166ac1839ead7de6e5956d9
Author: Rui Matos <tiagomatos gmail com>
Date: Fri Jun 24 03:41:32 2011 +0100
datetime: Restore TZ envvar as it was
tz_info_from_location() was changing the value of TZ, but not
restoring it when it was done checking data for it, and setting
the GMT timezone instead.
This meant that UTC time was displayed when the minute changed on
the wall clock.
https://bugzilla.gnome.org/show_bug.cgi?id=649568
panels/datetime/tz.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/panels/datetime/tz.c b/panels/datetime/tz.c
index 776418b..c539d59 100644
--- a/panels/datetime/tz.c
+++ b/panels/datetime/tz.c
@@ -203,10 +203,12 @@ tz_info_from_location (TzLocation *loc)
TzInfo *tzinfo;
time_t curtime;
struct tm *curzone;
+ gchar *tz_env_value;
g_return_val_if_fail (loc != NULL, NULL);
g_return_val_if_fail (loc->zone != NULL, NULL);
+ tz_env_value = g_strdup (getenv ("TZ"));
setenv ("TZ", loc->zone, 1);
#if 0
@@ -236,7 +238,12 @@ tz_info_from_location (TzLocation *loc)
tzinfo->daylight = curzone->tm_isdst;
- setenv ("TZ", "", 1);
+ if (tz_env_value)
+ setenv ("TZ", tz_env_value, 1);
+ else
+ unsetenv ("TZ");
+
+ g_free (tz_env_value);
return tzinfo;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]