diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-03-28 04:02:39 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-03-28 04:02:39 (GMT) |
commit | 02937aab13ecfe1f67b8de48c37412b0328217ec (patch) | |
tree | e6ae07581ca459a4b561f479d1610b2c5341fff2 /Include/pytime.h | |
parent | b3b454407058cd57d8a401a5aeb018d4ccb87616 (diff) | |
download | cpython-02937aab13ecfe1f67b8de48c37412b0328217ec.zip cpython-02937aab13ecfe1f67b8de48c37412b0328217ec.tar.gz cpython-02937aab13ecfe1f67b8de48c37412b0328217ec.tar.bz2 |
Issue #22117: Add the new _PyTime_ROUND_FLOOR rounding method for the datetime
module. time.clock_settime() now uses this rounding method instead of
_PyTime_ROUND_DOWN to handle correctly dates before 1970.
Diffstat (limited to 'Include/pytime.h')
-rw-r--r-- | Include/pytime.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Include/pytime.h b/Include/pytime.h index 654623e..0ff009a 100644 --- a/Include/pytime.h +++ b/Include/pytime.h @@ -38,8 +38,12 @@ PyAPI_FUNC(void) _PyTime_gettimeofday(_PyTime_timeval *tp); typedef enum { /* Round towards zero. */ _PyTime_ROUND_DOWN=0, - /* Round away from zero. */ - _PyTime_ROUND_UP + /* Round away from zero. + For example, used for timeout to wait "at least" N seconds. */ + _PyTime_ROUND_UP, + /* Round towards minus infinity (-inf). + For example, used to read a clock. */ + _PyTime_ROUND_FLOOR } _PyTime_round_t; /* Convert a number of seconds, int or float, to time_t. */ @@ -81,6 +85,9 @@ PyAPI_FUNC(int) _PyTime_Init(void); /****************** NEW _PyTime_t API **********************/ #ifdef PY_INT64_T +/* _PyTime_t: Python timestamp with subsecond precision. It can be used to + store a duration, and so indirectly a date (related to another date, like + UNIX epoch). */ typedef PY_INT64_T _PyTime_t; #define _PyTime_MIN PY_LLONG_MIN #define _PyTime_MAX PY_LLONG_MAX |