[Python-checkins] cpython: Issue #22043: Fix pymonotonic(), use tv_usec=-1 as a marker to skip
victor.stinner
python-checkins at python.org
Wed Sep 3 09:44:06 CEST 2014
http://hg.python.org/cpython/rev/9deef14393d5
changeset: 92307:9deef14393d5
user: Victor Stinner <victor.stinner at gmail.com>
date: Wed Sep 03 09:43:48 2014 +0200
summary:
Issue #22043: Fix pymonotonic(), use tv_usec=-1 as a marker to skip
the monotonic test
files:
Python/pytime.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/Python/pytime.c b/Python/pytime.c
--- a/Python/pytime.c
+++ b/Python/pytime.c
@@ -121,7 +121,7 @@
pymonotonic(_PyTime_timeval *tp, _Py_clock_info_t *info, int raise)
{
#ifdef Py_DEBUG
- static _PyTime_timeval last = {-1, -1};
+ static _PyTime_timeval last = {0, -1};
#endif
#if defined(MS_WINDOWS)
static ULONGLONG (*GetTickCount64) (void) = NULL;
@@ -247,7 +247,8 @@
assert(0 <= tp->tv_usec && tp->tv_usec < 1000 * 1000);
#ifdef Py_DEBUG
/* monotonic clock cannot go backward */
- assert(tp->tv_sec > last.tv_sec
+ assert(last.tv_usec == -1
+ || tp->tv_sec > last.tv_sec
|| (tp->tv_sec == last.tv_sec && tp->tv_usec >= last.tv_usec));
last = *tp;
#endif
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list