1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
-
+
|
/*
* tclWinTime.c --
*
* Contains Windows specific versions of Tcl functions that
* obtain time values from the operating system.
*
* Copyright 1995-1998 by Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclWinTime.c,v 1.18.2.6 2004/05/04 17:44:21 dgp Exp $
* RCS: @(#) $Id: tclWinTime.c,v 1.18.2.7 2004/05/17 18:42:25 dgp Exp $
*/
#include "tclInt.h"
#define SECSPERDAY (60L * 60L * 24L)
#define SECSPERYEAR (SECSPERDAY * 365L)
#define SECSPER4YEAR (SECSPERYEAR * 4L + SECSPERDAY)
|
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
|
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
|
-
+
|
H. Giese, June 2003
*/
#ifdef __BORLANDC__
if (*t >= SECSPERDAY) {
#else
if (*t >= 0) {
#endif
return localtime(t);
return TclpLocaltime(t);
}
time = *t - timezone;
/*
* If we aren't near to overflowing the long, just add the bias and
* use the normal calculation. Otherwise we will need to adjust
|
1080
1081
1082
1083
1084
1085
1086
|
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
if ( ++timeInfo.sampleNo >= SAMPLES ) {
timeInfo.sampleNo = 0;
}
return estFreq;
}
}
/*
*----------------------------------------------------------------------
*
* TclpGmtime --
*
* Wrapper around the 'gmtime' library function to make it thread
* safe.
*
* Results:
* Returns a pointer to a 'struct tm' in thread-specific data.
*
* Side effects:
* Invokes gmtime or gmtime_r as appropriate.
*
*----------------------------------------------------------------------
*/
struct tm *
TclpGmtime( timePtr )
CONST time_t *timePtr; /* Pointer to the number of seconds
* since the local system's epoch */
{
/*
* The MS implementation of gmtime is thread safe because
* it returns the time in a block of thread-local storage,
* and Windows does not provide a Posix gmtime_r function.
*/
return gmtime( timePtr );
}
/*
*----------------------------------------------------------------------
*
* TclpLocaltime --
*
* Wrapper around the 'localtime' library function to make it thread
* safe.
*
* Results:
* Returns a pointer to a 'struct tm' in thread-specific data.
*
* Side effects:
* Invokes localtime or localtime_r as appropriate.
*
*----------------------------------------------------------------------
*/
struct tm *
TclpLocaltime( timePtr )
CONST time_t *timePtr; /* Pointer to the number of seconds
* since the local system's epoch */
{
/*
* The MS implementation of localtime is thread safe because
* it returns the time in a block of thread-local storage,
* and Windows does not provide a Posix localtime_r function.
*/
return localtime( timePtr );
}
|