Tcl Source Code

View Ticket
Login
Ticket UUID: 656765
Title: formatClock/cygwin compile fix
Type: Patch Version: None
Submitter: pascalscheffers Created on: 2002-12-20 12:27:46
Subsystem: 06. Time Measurement Assigned To: kennykb
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2004-08-19 22:42:01
Resolution: Fixed Closed By: kennykb
    Closed on: 2004-08-19 15:42:01
Description:
in generic/tclClock.c:formatClock

there are two assignments to timezone (from time.h),
but because cygwin defines timezone:

#define timezone ((long int) _timezone)

gcc does not accept it as an correct lvalue for:

tclClock.c: 310
    timezone = 0;

(this is in a '#ifdef kludge for timezone not in struct
TM_ZONE required' block)

my patch fixes it so it compiles again by directly
using _timezone #if defined(__CYGWIN__).
User Comments: kennykb added on 2004-08-19 22:42:01:
Logged In: YES 
user_id=99768

The relevant code in tclClock.c isn't even there in 8.5,
so any changes needed to make it compile appear to be
moot.

winstan added on 2004-02-13 02:37:32:
Logged In: YES 
user_id=972673

--- tcl8.4.5/generic/tclClock.c2003-02-01
+++ tcl8.4.5-fix/generic/tclClock.c2004-02-12
@@ -311,8 +311,13 @@
             savedTZEnv = NULL;
 }
     Tcl_SetVar2(interp, "env", "TZ", "GMT", TCL_GLOBAL_ONLY);
+#if !defined(__CYGWIN__)
         savedTimeZone = timezone;
         timezone = 0;
+#else
+        savedTimeZone = _timezone;
+        _timezone = 0;
+#endif
         tzset();
     }
 #endif
@@ -357,7 +362,11 @@
         } else {
            Tcl_UnsetVar2(interp, "env", "TZ", TCL_GLOBAL_ONLY);
         }
+#if !defined(__CYGWIN__)
         timezone = savedTimeZone;
+#else
+        _timezone = savedTimeZone;
+#endif
         tzset();
     }
     Tcl_MutexUnlock( &clockMutex );

winstan added on 2004-02-13 02:30:00:
Logged In: YES 
user_id=972673

This patch breaks what the #ifdef kludge is trying to do:
Save timezone and restore it later.

If the first #if !defined(__CYGWIN__) is moved up one line
to include
   savedTimeZone = timezone;
then it'll still work.

I'll try to attach a patch for 8.4.5

chomo added on 2004-02-02 02:49:17:
Logged In: YES 
user_id=943591

not do harm

pascalscheffers added on 2002-12-20 19:37:25:

File Added - 38005: clock-cygwin-8.4.1.patch

Attachments: