Merged trunk changes r9797:9829 into 217update branch.
diff -u gnome-system-tools-2.14.0/src/time/tz.c-orig gnome-system-tools-2.14.0/src/time/tz.c
--- gnome-system-tools-2.14.0/src/time/tz.c-orig 2006-08-30 13:21:28.347797000 +0100
+++ gnome-system-tools-2.14.0/src/time/tz.c 2006-08-30 12:52:20.680444000 +0100
@@ -76,8 +76,17 @@
if (*buf == '#') continue;
g_strchomp(buf);
- tmpstrarr = g_strsplit(buf,"\t", 4);
+ tmpstrarr = g_strsplit(buf,"\t", 6);
+ /* If the zone ends with a '/' then it should be skipped */
+ if (tmpstrarr[2] ) {
+ int lastchar=strlen(tmpstrarr[2]) - 1;
+ if (lastchar >= 0 && tmpstrarr[2][lastchar] == '/' ) {
+ g_strfreev (tmpstrarr);
+ continue;
+ }
+ }
+
latstr = g_strdup (tmpstrarr[1]);
p = latstr + 1;
while (*p != '-' && *p != '+') p++;
@@ -87,12 +96,29 @@
loc = g_new (TzLocation, 1);
loc->country = g_strdup (tmpstrarr[0]);
loc->zone = g_strdup (tmpstrarr[2]);
- loc->comment = (tmpstrarr[3]) ? g_strdup(tmpstrarr[3]) : NULL;
loc->latitude = convert_pos (latstr, 2);
loc->longitude = convert_pos (lngstr, 3);
-
+ if (tmpstrarr[3] && *tmpstrarr[3] == '-' && tmpstrarr[4])
+ loc->comment = g_strdup(tmpstrarr[4]);
+ else if (tmpstrarr[3] && *tmpstrarr[3] != '-' && !g_ascii_islower(loc->zone[0])) {
+ TzLocation *locgrp;
+ /* duplicate entry */
+ locgrp = g_new (TzLocation, 1);
+ locgrp->country = g_strdup (tmpstrarr[0]);
+ locgrp->zone = g_strdup (tmpstrarr[3]);
+ locgrp->latitude = loc->latitude;
+ locgrp->longitude = loc->longitude;
+ if (tmpstrarr[4]) {
+ loc->comment = g_strdup(tmpstrarr[4]);
+ locgrp->comment = g_strdup(tmpstrarr[4]);
+ } else {
+ loc->comment = locgrp->comment = NULL;
+ }
+ g_ptr_array_add (tz_db->locations, (gpointer) locgrp);
+ } else
+ loc->comment = NULL;
g_ptr_array_add (tz_db->locations, (gpointer) loc);
-
+
g_free (latstr);
g_free (lngstr);
g_strfreev (tmpstrarr);
@@ -213,6 +239,7 @@
curtime = time (NULL);
curzone = localtime (&curtime);
+#ifndef __sun
/* Currently this solution doesnt seem to work - I get that */
/* America/Phoenix uses daylight savings, which is wrong */
tzinfo->tzname_normal = g_strdup (curzone->tm_zone);
@@ -221,8 +248,13 @@
g_strdup (&curzone->tm_zone[curzone->tm_isdst]);
else
tzinfo->tzname_daylight = NULL;
-
tzinfo->utc_offset = curzone->tm_gmtoff;
+#else
+ tzinfo->tzname_normal = NULL;
+ tzinfo->tzname_daylight = NULL;
+ tzinfo->utc_offset = 0;
+#endif
+
tzinfo->daylight = curzone->tm_isdst;
return tzinfo;