Good heavens, I am surprised this bug is still open!  I should check my
open bugs once in awhile.

Unfortunately, yes, it is still broken.  In the intervening years I
learned how to fix :)

The problem is that the code for displaying the timezone name currently
always refers to tzname[0].  The short name for the zone in daylight
saving time is stored in tzname[1].  It so happens that localtime() sets
an extern int daylight when called.

I have included a simple patch to fix the problem.  My apologies for the
fuzz in the patch; I had to do some other trickery to get the code to
compile.

Cheers!
Only in wmtz-0.7-fixed/wmgeneral: list.o
Only in wmtz-0.7-fixed/wmgeneral: misc.o
Only in wmtz-0.7-fixed/wmgeneral: wmgeneral.o
Only in wmtz-0.7-fixed/wmtz: wmtz
diff -ur wmtz-0.7/wmtz/wmtz.c wmtz-0.7-fixed/wmtz/wmtz.c
--- wmtz-0.7/wmtz/wmtz.c	2001-04-16 15:26:34.000000000 -0400
+++ wmtz-0.7-fixed/wmtz/wmtz.c	2009-06-20 20:10:06.000000000 -0400
@@ -51,7 +51,7 @@
 #define STRSIZE 10
 #define LMST 1
 #define GMST 0
-#define ABOUT "xmessage -center -buttons \"Close\" \"WMTZ - Window Maker Time Zone dockapp v0.7
+#define ABOUT "xmessage -center -buttons \"Close\" \"WMTZ - Window Maker Time Zone dockapp v0.7 \
 http://www.geocities.com/jl1n/wmtz/wmtz.html\"";
 
 
@@ -86,6 +86,7 @@
 int           mono = 0;
 extern char   *tzname[2];
 static char   originalTZ[64];
+extern int    daylight;
 
 /*
  * Function declarations
@@ -379,7 +380,7 @@
 	    else if (strncmp( zone[j].label, "LOCAL", 5) == 0 )
 	    {
 	      clk = localtime(&curtime);
-	      strncpy(buf, tzname[0], 3);
+	      strncpy(buf, tzname[daylight], 3);
 	      
               for (k=0; k<3; k++)
                 if (buf[k] == 0)
@@ -401,7 +402,7 @@
 	      tzset();
 	      clk = localtime(&curtime);
 
-	      strncpy(buf, tzname[0], 3);
+	      strncpy(buf, tzname[daylight], 3);
 	      
               for (k=0; k<3; k++)
                 if (buf[k] == 0)
@@ -479,6 +480,7 @@
 		   but_stat = -1;
                    break;
 	    default:
+		break;
 	  }
         }  
 
@@ -529,6 +531,7 @@
 	    exit(0);
 	    break;
 	default:
+		break;
       }
     return;
 }
Only in wmtz-0.7-fixed/wmtz: wmtz.o

Reply via email to