summaryrefslogtreecommitdiffstats
path: root/win/tclWinTime.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-09-14 21:52:20 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-09-14 21:52:20 (GMT)
commitc9396a84a899e88fa02dd17df5601e9b2fd0cef4 (patch)
tree7188f5fa190c980eee21173bf1c5a8b807398002 /win/tclWinTime.c
parent96c82a32e19afd4581f3aa21da39c8c6aa90bd7c (diff)
parent93022718af12833e135ad743bc6169bcfd443ddf (diff)
downloadtcl-c9396a84a899e88fa02dd17df5601e9b2fd0cef4.zip
tcl-c9396a84a899e88fa02dd17df5601e9b2fd0cef4.tar.gz
tcl-c9396a84a899e88fa02dd17df5601e9b2fd0cef4.tar.bz2
Merge 8.7
Diffstat (limited to 'win/tclWinTime.c')
-rw-r--r--win/tclWinTime.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/win/tclWinTime.c b/win/tclWinTime.c
index 39e1100..2b6d60b 100644
--- a/win/tclWinTime.c
+++ b/win/tclWinTime.c
@@ -740,6 +740,11 @@ TclpGetDate(
{
struct tm *tmPtr;
time_t time;
+#if defined(_WIN64) || (defined(_USE_64BIT_TIME_T) || (defined(_MSC_VER) && _MSC_VER < 1400))
+# define t2 *t /* no need to cripple time to 32-bit */
+#else
+ time_t t2 = *(__time32_t *)t;
+#endif
if (!useGMT) {
#if defined(_MSC_VER) && (_MSC_VER >= 1900)
@@ -772,15 +777,15 @@ TclpGetDate(
#define LOCALTIME_VALIDITY_BOUNDARY 0
#endif
- if (*t >= LOCALTIME_VALIDITY_BOUNDARY) {
- return TclpLocaltime(t);
+ if (t2 >= LOCALTIME_VALIDITY_BOUNDARY) {
+ return TclpLocaltime(&t2);
}
#if defined(_MSC_VER) && (_MSC_VER >= 1900)
_get_timezone(&timezone);
#endif
- time = *t - timezone;
+ time = t2 - timezone;
/*
* If we aren't near to overflowing the long, just add the bias and
@@ -788,10 +793,10 @@ TclpGetDate(
* result at the end.
*/
- if (*t < (LONG_MAX - 2*SECSPERDAY) && *t > (LONG_MIN + 2*SECSPERDAY)) {
+ if (t2 < (LONG_MAX - 2*SECSPERDAY) && t2 > (LONG_MIN + 2*SECSPERDAY)) {
tmPtr = ComputeGMT(&time);
} else {
- tmPtr = ComputeGMT(t);
+ tmPtr = ComputeGMT(&t2);
tzset();
@@ -827,7 +832,7 @@ TclpGetDate(
tmPtr->tm_wday = (tmPtr->tm_wday + (int)time) % 7;
}
} else {
- tmPtr = ComputeGMT(t);
+ tmPtr = ComputeGMT(&t2);
}
return tmPtr;
}
@@ -1364,7 +1369,11 @@ TclpGmtime(
* Posix gmtime_r function.
*/
+#if defined(_WIN64) || defined(_USE_64BIT_TIME_T) || (defined(_MSC_VER) && _MSC_VER < 1400)
return gmtime(timePtr);
+#else
+ return _gmtime32((CONST __time32_t *)timePtr);
+#endif
}
/*
@@ -1395,7 +1404,11 @@ TclpLocaltime(
* provide a Posix localtime_r function.
*/
+#if defined(_WIN64) || defined(_USE_64BIT_TIME_T) || (defined(_MSC_VER) && _MSC_VER < 1400)
return localtime(timePtr);
+#else
+ return _localtime32((CONST __time32_t *)timePtr);
+#endif
}
#endif /* TCL_NO_DEPRECATED */