diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-09-21 09:16:35 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-09-21 09:16:35 (GMT) |
commit | 1a857a4b46eea001e583cf67b5be4a22beefaa45 (patch) | |
tree | 06d610270f88d3a23add11613f57924759a967d5 /generic/tkBind.c | |
parent | b0a98593be2e45bf26af4553f4029b1dd1194b55 (diff) | |
download | tk-1a857a4b46eea001e583cf67b5be4a22beefaa45.zip tk-1a857a4b46eea001e583cf67b5be4a22beefaa45.tar.gz tk-1a857a4b46eea001e583cf67b5be4a22beefaa45.tar.bz2 |
Fully handle 64-bit sec/usec values when Win64 Tk is loaded in Cygwin64 Tclsh
Diffstat (limited to 'generic/tkBind.c')
-rw-r--r-- | generic/tkBind.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/generic/tkBind.c b/generic/tkBind.c index e8f15c9..b338918 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -817,11 +817,21 @@ GetButtonNumber( static Time CurrentTimeInMilliSecs(void) { - struct { + union { Tcl_Time now; - Tcl_Time dummy; /* Spare, in case Tcl_Time has 32-bit fields */ + struct { + long long sec; /* reserve stack space enough for 64-bit fields */ + long long usec; + } lnow; } t; + t.lnow.usec = -1; /* Invalid usec value, so we can see if Tcl_GetTime overwrites it */ Tcl_GetTime(&t.now); +#ifdef __WIN64 + if (t.lnow.usec != -1) { + /* Win64 Tk loaded in Cygwin-64: Tcl_GetTime() returns 64-bit fields */ + return ((Time) t.lnow.sec)*1000 + ((Time) t.lnow.usec)/1000; + } +#endif return ((Time) t.now.sec)*1000 + ((Time) t.now.usec)/1000; } |