Skip to content
Tcl Source Code View Ticket
Login

View Ticket

FormatClock clockVal size mismatch

Closed / Fixed1163422fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2005-03-15 01:37:58
A test failure (winTime-1.1) on Win64-ia64 showed that
FormatClock was not using the right integral size for
clockVal.  Same with baseVal in Tcl_ClockObjCmd.  They
should be time_t instead of (unsigned long).  This can
be a problem on any system where sizeof(time_t) >
sizeof(long).  This has to be reconciled with the use
of Tcl_GetLongObj in Tcl_ClockObjCmd.
kennykbplain2005-03-15 23:35:18
Logged In: YES 
user_id=99768

Hoo, boy, that had its tendrils in a lot of places...
Give it a try against the 8.4 branch tip, will you?
Also, it shouldn't fail in 8.5, if it does, it's a different
bug because the code I fixed isn't even *in* 8.5.
If you do have problems with it in 8.5, please open
a new bug for them.
hobbsplain2005-03-16 07:46:56
Logged In: YES 
user_id=72656

Reopening as the fix changed the result, but didn't fix it.
 I will look into this and confirm any changes
hobbsplain2005-03-16 08:25:23
Logged In: YES 
user_id=72656

OK, we could be more screwed than I thought.  The Tcl_Time
public struct defined in tcl.h uses *longs*, not time_t
(argh - why!!!!).  This may affect some of the time
accuracy.  However, the following single change was all that
was required to make the -1 case work on Win64-ia64:

win/tclWinTime.c:
@@ -581,7 +581,7 @@
 {
     const time_t *tp = (const time_t *) t;
     struct tm *tmPtr;
-    long time;
+    time_t time;

     if (!useGMT) {
        tzset();

Can you confirm that "reliability" of that fix?  I honed in
on that when I noticed that using -gmt 1 to clock format
didn't have an issue (at least with your interim patch), but
-gmt 0 still did.
hobbsplain2005-03-30 12:33:12
Logged In: YES 
user_id=72656

Fixed in 8.4-branch with the cast correction.
Log in (anonymous is fine) to add a comment.