diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-03-29 22:09:18 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-03-29 22:09:18 (GMT) |
commit | 09e5cf28aef05ad07bf885c1b732eb567470199a (patch) | |
tree | e6c02fd1e758f7f6312d1651e20703565a33efb1 /Include/pytime.h | |
parent | 10915aa85cf264caf6e606a10f1dd204663d6d5a (diff) | |
download | cpython-09e5cf28aef05ad07bf885c1b732eb567470199a.zip cpython-09e5cf28aef05ad07bf885c1b732eb567470199a.tar.gz cpython-09e5cf28aef05ad07bf885c1b732eb567470199a.tar.bz2 |
Issue #22117: Use the _PyTime_t API in _datetime.datetime() constructor
* Remove _PyTime_gettimeofday()
* Add _PyTime_GetSystemClock()
Diffstat (limited to 'Include/pytime.h')
-rw-r--r-- | Include/pytime.h | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/Include/pytime.h b/Include/pytime.h index 0ff009a..919ba30 100644 --- a/Include/pytime.h +++ b/Include/pytime.h @@ -13,15 +13,6 @@ functions and constants extern "C" { #endif -#ifdef HAVE_GETTIMEOFDAY -typedef struct timeval _PyTime_timeval; -#else -typedef struct { - time_t tv_sec; /* seconds since Jan. 1, 1970 */ - long tv_usec; /* and microseconds */ -} _PyTime_timeval; -#endif - /* Structure used by time.get_clock_info() */ typedef struct { const char *implementation; @@ -30,11 +21,6 @@ typedef struct { double resolution; } _Py_clock_info_t; -/* Similar to POSIX gettimeofday but cannot fail. If system gettimeofday - * fails or is not available, fall back to lower resolution clocks. - */ -PyAPI_FUNC(void) _PyTime_gettimeofday(_PyTime_timeval *tp); - typedef enum { /* Round towards zero. */ _PyTime_ROUND_DOWN=0, @@ -134,6 +120,12 @@ PyAPI_FUNC(int) _PyTime_AsTimespec(_PyTime_t t, struct timespec *ts); #endif /* Get the current time from the system clock. + + The function cannot fail. _PyTime_Init() ensures that the system clock + works. */ +PyAPI_FUNC(_PyTime_t) _PyTime_GetSystemClock(void); + +/* Get the current time from the system clock. * Fill clock information if info is not NULL. * Raise an exception and return -1 on error, return 0 on success. */ |