@@ -62,7 +62,7 @@ extern "C" {
62
62
struct timeval ;
63
63
#endif
64
64
65
- typedef PyTime_t _PyTime_t ;
65
+ typedef PyTime_t PyTime_t ;
66
66
#define _SIZEOF_PYTIME_T 8
67
67
68
68
typedef enum {
@@ -130,84 +130,84 @@ PyAPI_FUNC(int) _PyTime_ObjectToTimespec(
130
130
131
131
// Create a timestamp from a number of seconds.
132
132
// Export for '_socket' shared extension.
133
- PyAPI_FUNC (_PyTime_t ) _PyTime_FromSeconds (int seconds );
133
+ PyAPI_FUNC (PyTime_t ) _PyTime_FromSeconds (int seconds );
134
134
135
135
// Create a timestamp from a number of seconds in double.
136
136
// Export for '_socket' shared extension.
137
- PyAPI_FUNC (_PyTime_t ) _PyTime_FromSecondsDouble (double seconds , _PyTime_round_t round );
137
+ PyAPI_FUNC (PyTime_t ) _PyTime_FromSecondsDouble (double seconds , _PyTime_round_t round );
138
138
139
139
// Macro to create a timestamp from a number of seconds, no integer overflow.
140
140
// Only use the macro for small values, prefer _PyTime_FromSeconds().
141
141
#define _PYTIME_FROMSECONDS (seconds ) \
142
- ((_PyTime_t )(seconds) * (1000 * 1000 * 1000))
142
+ ((PyTime_t )(seconds) * (1000 * 1000 * 1000))
143
143
144
144
// Create a timestamp from a number of nanoseconds.
145
145
// Export for '_testinternalcapi' shared extension.
146
- PyAPI_FUNC (_PyTime_t ) _PyTime_FromNanoseconds (_PyTime_t ns );
146
+ PyAPI_FUNC (PyTime_t ) _PyTime_FromNanoseconds (PyTime_t ns );
147
147
148
148
// Create a timestamp from a number of microseconds.
149
149
// Clamp to [PyTime_MIN; PyTime_MAX] on overflow.
150
- extern _PyTime_t _PyTime_FromMicrosecondsClamp (_PyTime_t us );
150
+ extern PyTime_t _PyTime_FromMicrosecondsClamp (PyTime_t us );
151
151
152
152
// Create a timestamp from nanoseconds (Python int).
153
153
// Export for '_lsprof' shared extension.
154
- PyAPI_FUNC (int ) _PyTime_FromNanosecondsObject (_PyTime_t * t ,
154
+ PyAPI_FUNC (int ) _PyTime_FromNanosecondsObject (PyTime_t * t ,
155
155
PyObject * obj );
156
156
157
157
// Convert a number of seconds (Python float or int) to a timestamp.
158
158
// Raise an exception and return -1 on error, return 0 on success.
159
159
// Export for '_socket' shared extension.
160
- PyAPI_FUNC (int ) _PyTime_FromSecondsObject (_PyTime_t * t ,
160
+ PyAPI_FUNC (int ) _PyTime_FromSecondsObject (PyTime_t * t ,
161
161
PyObject * obj ,
162
162
_PyTime_round_t round );
163
163
164
164
// Convert a number of milliseconds (Python float or int, 10^-3) to a timestamp.
165
165
// Raise an exception and return -1 on error, return 0 on success.
166
166
// Export for 'select' shared extension.
167
- PyAPI_FUNC (int ) _PyTime_FromMillisecondsObject (_PyTime_t * t ,
167
+ PyAPI_FUNC (int ) _PyTime_FromMillisecondsObject (PyTime_t * t ,
168
168
PyObject * obj ,
169
169
_PyTime_round_t round );
170
170
171
171
// Convert timestamp to a number of milliseconds (10^-3 seconds).
172
172
// Export for '_ssl' shared extension.
173
- PyAPI_FUNC (_PyTime_t ) _PyTime_AsMilliseconds (_PyTime_t t ,
173
+ PyAPI_FUNC (PyTime_t ) _PyTime_AsMilliseconds (PyTime_t t ,
174
174
_PyTime_round_t round );
175
175
176
176
// Convert timestamp to a number of microseconds (10^-6 seconds).
177
177
// Export for '_queue' shared extension.
178
- PyAPI_FUNC (_PyTime_t ) _PyTime_AsMicroseconds (_PyTime_t t ,
178
+ PyAPI_FUNC (PyTime_t ) _PyTime_AsMicroseconds (PyTime_t t ,
179
179
_PyTime_round_t round );
180
180
181
181
#ifdef MS_WINDOWS
182
182
// Convert timestamp to a number of 100 nanoseconds (10^-7 seconds).
183
- extern _PyTime_t _PyTime_As100Nanoseconds (_PyTime_t t ,
183
+ extern PyTime_t _PyTime_As100Nanoseconds (PyTime_t t ,
184
184
_PyTime_round_t round );
185
185
#endif
186
186
187
187
// Convert timestamp to a number of nanoseconds (10^-9 seconds) as a Python int
188
188
// object.
189
189
// Export for '_testinternalcapi' shared extension.
190
- PyAPI_FUNC (PyObject * ) _PyTime_AsNanosecondsObject (_PyTime_t t );
190
+ PyAPI_FUNC (PyObject * ) _PyTime_AsNanosecondsObject (PyTime_t t );
191
191
192
192
#ifndef MS_WINDOWS
193
193
// Create a timestamp from a timeval structure.
194
194
// Raise an exception and return -1 on overflow, return 0 on success.
195
- extern int _PyTime_FromTimeval (_PyTime_t * tp , struct timeval * tv );
195
+ extern int _PyTime_FromTimeval (PyTime_t * tp , struct timeval * tv );
196
196
#endif
197
197
198
198
// Convert a timestamp to a timeval structure (microsecond resolution).
199
199
// tv_usec is always positive.
200
200
// Raise an exception and return -1 if the conversion overflowed,
201
201
// return 0 on success.
202
202
// Export for 'select' shared extension.
203
- PyAPI_FUNC (int ) _PyTime_AsTimeval (_PyTime_t t ,
203
+ PyAPI_FUNC (int ) _PyTime_AsTimeval (PyTime_t t ,
204
204
struct timeval * tv ,
205
205
_PyTime_round_t round );
206
206
207
207
// Similar to _PyTime_AsTimeval() but don't raise an exception on overflow.
208
- // On overflow, clamp tv_sec to _PyTime_t min/max.
208
+ // On overflow, clamp tv_sec to PyTime_t min/max.
209
209
// Export for 'select' shared extension.
210
- PyAPI_FUNC (void ) _PyTime_AsTimeval_clamp (_PyTime_t t ,
210
+ PyAPI_FUNC (void ) _PyTime_AsTimeval_clamp (PyTime_t t ,
211
211
struct timeval * tv ,
212
212
_PyTime_round_t round );
213
213
@@ -219,31 +219,31 @@ PyAPI_FUNC(void) _PyTime_AsTimeval_clamp(_PyTime_t t,
219
219
// return 0 on success.
220
220
// Export for '_datetime' shared extension.
221
221
PyAPI_FUNC (int ) _PyTime_AsTimevalTime_t (
222
- _PyTime_t t ,
222
+ PyTime_t t ,
223
223
time_t * secs ,
224
224
int * us ,
225
225
_PyTime_round_t round );
226
226
227
227
#if defined(HAVE_CLOCK_GETTIME ) || defined(HAVE_KQUEUE )
228
228
// Create a timestamp from a timespec structure.
229
229
// Raise an exception and return -1 on overflow, return 0 on success.
230
- extern int _PyTime_FromTimespec (_PyTime_t * tp , const struct timespec * ts );
230
+ extern int _PyTime_FromTimespec (PyTime_t * tp , const struct timespec * ts );
231
231
232
232
// Convert a timestamp to a timespec structure (nanosecond resolution).
233
233
// tv_nsec is always positive.
234
234
// Raise an exception and return -1 on error, return 0 on success.
235
235
// Export for '_testinternalcapi' shared extension.
236
- PyAPI_FUNC (int ) _PyTime_AsTimespec (_PyTime_t t , struct timespec * ts );
236
+ PyAPI_FUNC (int ) _PyTime_AsTimespec (PyTime_t t , struct timespec * ts );
237
237
238
238
// Similar to _PyTime_AsTimespec() but don't raise an exception on overflow.
239
- // On overflow, clamp tv_sec to _PyTime_t min/max.
239
+ // On overflow, clamp tv_sec to PyTime_t min/max.
240
240
// Export for '_testinternalcapi' shared extension.
241
- PyAPI_FUNC (void ) _PyTime_AsTimespec_clamp (_PyTime_t t , struct timespec * ts );
241
+ PyAPI_FUNC (void ) _PyTime_AsTimespec_clamp (PyTime_t t , struct timespec * ts );
242
242
#endif
243
243
244
244
245
245
// Compute t1 + t2. Clamp to [PyTime_MIN; PyTime_MAX] on overflow.
246
- extern _PyTime_t _PyTime_Add (_PyTime_t t1 , _PyTime_t t2 );
246
+ extern PyTime_t _PyTime_Add (PyTime_t t1 , PyTime_t t2 );
247
247
248
248
// Structure used by time.get_clock_info()
249
249
typedef struct {
@@ -262,13 +262,13 @@ typedef struct {
262
262
// Use _PyTime_GetSystemClockWithInfo or the public PyTime_Time() to check
263
263
// for failure.
264
264
// Export for '_random' shared extension.
265
- PyAPI_FUNC (_PyTime_t ) _PyTime_GetSystemClock (void );
265
+ PyAPI_FUNC (PyTime_t ) _PyTime_GetSystemClock (void );
266
266
267
267
// Get the current time from the system clock.
268
268
// On success, set *t and *info (if not NULL), and return 0.
269
269
// On error, raise an exception and return -1.
270
270
extern int _PyTime_GetSystemClockWithInfo (
271
- _PyTime_t * t ,
271
+ PyTime_t * t ,
272
272
_Py_clock_info_t * info );
273
273
274
274
// Get the time of a monotonic clock, i.e. a clock that cannot go backwards.
@@ -283,7 +283,7 @@ extern int _PyTime_GetSystemClockWithInfo(
283
283
// Use _PyTime_GetMonotonicClockWithInfo or the public PyTime_Monotonic()
284
284
// to check for failure.
285
285
// Export for '_random' shared extension.
286
- PyAPI_FUNC (_PyTime_t ) _PyTime_GetMonotonicClock (void );
286
+ PyAPI_FUNC (PyTime_t ) _PyTime_GetMonotonicClock (void );
287
287
288
288
// Get the time of a monotonic clock, i.e. a clock that cannot go backwards.
289
289
// The clock is not affected by system clock updates. The reference point of
@@ -295,7 +295,7 @@ PyAPI_FUNC(_PyTime_t) _PyTime_GetMonotonicClock(void);
295
295
// Return 0 on success, raise an exception and return -1 on error.
296
296
// Export for '_testsinglephase' shared extension.
297
297
PyAPI_FUNC (int ) _PyTime_GetMonotonicClockWithInfo (
298
- _PyTime_t * t ,
298
+ PyTime_t * t ,
299
299
_Py_clock_info_t * info );
300
300
301
301
@@ -319,7 +319,7 @@ PyAPI_FUNC(int) _PyTime_gmtime(time_t t, struct tm *tm);
319
319
// Use _PyTime_GetPerfCounterWithInfo() or the public PyTime_PerfCounter
320
320
// to check for failure.
321
321
// Export for '_lsprof' shared extension.
322
- PyAPI_FUNC (_PyTime_t ) _PyTime_GetPerfCounter (void );
322
+ PyAPI_FUNC (PyTime_t ) _PyTime_GetPerfCounter (void );
323
323
324
324
325
325
// Get the performance counter: clock with the highest available resolution to
@@ -329,7 +329,7 @@ PyAPI_FUNC(_PyTime_t) _PyTime_GetPerfCounter(void);
329
329
//
330
330
// Return 0 on success, raise an exception and return -1 on error.
331
331
extern int _PyTime_GetPerfCounterWithInfo (
332
- _PyTime_t * t ,
332
+ PyTime_t * t ,
333
333
_Py_clock_info_t * info );
334
334
335
335
// Alias for backward compatibility
@@ -343,33 +343,33 @@ extern int _PyTime_GetPerfCounterWithInfo(
343
343
// Create a deadline.
344
344
// Pseudo code: _PyTime_GetMonotonicClock() + timeout.
345
345
// Export for '_ssl' shared extension.
346
- PyAPI_FUNC (_PyTime_t ) _PyDeadline_Init (_PyTime_t timeout );
346
+ PyAPI_FUNC (PyTime_t ) _PyDeadline_Init (PyTime_t timeout );
347
347
348
348
// Get remaining time from a deadline.
349
349
// Pseudo code: deadline - _PyTime_GetMonotonicClock().
350
350
// Export for '_ssl' shared extension.
351
- PyAPI_FUNC (_PyTime_t ) _PyDeadline_Get (_PyTime_t deadline );
351
+ PyAPI_FUNC (PyTime_t ) _PyDeadline_Get (PyTime_t deadline );
352
352
353
353
354
354
// --- _PyTimeFraction -------------------------------------------------------
355
355
356
356
typedef struct {
357
- _PyTime_t numer ;
358
- _PyTime_t denom ;
357
+ PyTime_t numer ;
358
+ PyTime_t denom ;
359
359
} _PyTimeFraction ;
360
360
361
361
// Set a fraction.
362
362
// Return 0 on success.
363
363
// Return -1 if the fraction is invalid.
364
364
extern int _PyTimeFraction_Set (
365
365
_PyTimeFraction * frac ,
366
- _PyTime_t numer ,
367
- _PyTime_t denom );
366
+ PyTime_t numer ,
367
+ PyTime_t denom );
368
368
369
369
// Compute ticks * frac.numer / frac.denom.
370
370
// Clamp to [_PyTime_MIN; _PyTime_MAX] on overflow.
371
- extern _PyTime_t _PyTimeFraction_Mul (
372
- _PyTime_t ticks ,
371
+ extern PyTime_t _PyTimeFraction_Mul (
372
+ PyTime_t ticks ,
373
373
const _PyTimeFraction * frac );
374
374
375
375
// Compute a clock resolution: frac.numer / frac.denom / 1e9.
0 commit comments