mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Issue #22043: Fix _PyTime_gettimeofday() if HAVE_GETTIMEOFDAY
Ensure also that the tv_usec field is consistent: in range [0; 999999].
This commit is contained in:
parent
5791a5403b
commit
9bb758cee7
1 changed files with 2 additions and 5 deletions
|
|
@ -37,7 +37,6 @@ pygettimeofday(_PyTime_timeval *tp, _Py_clock_info_t *info, int raise)
|
||||||
info->resolution = timeIncrement * 1e-7;
|
info->resolution = timeIncrement * 1e-7;
|
||||||
info->adjustable = 1;
|
info->adjustable = 1;
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
|
|
||||||
#else /* MS_WINDOWS */
|
#else /* MS_WINDOWS */
|
||||||
int err;
|
int err;
|
||||||
|
|
@ -67,11 +66,9 @@ pygettimeofday(_PyTime_timeval *tp, _Py_clock_info_t *info, int raise)
|
||||||
else
|
else
|
||||||
info->resolution = 1e-9;
|
info->resolution = 1e-9;
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
#else /* HAVE_CLOCK_GETTIME */
|
#else /* HAVE_CLOCK_GETTIME */
|
||||||
|
|
||||||
/* test gettimeofday() */
|
/* test gettimeofday() */
|
||||||
#ifdef HAVE_GETTIMEOFDAY
|
|
||||||
#ifdef GETTIMEOFDAY_NO_TZ
|
#ifdef GETTIMEOFDAY_NO_TZ
|
||||||
err = gettimeofday(tp);
|
err = gettimeofday(tp);
|
||||||
#else
|
#else
|
||||||
|
|
@ -89,10 +86,10 @@ pygettimeofday(_PyTime_timeval *tp, _Py_clock_info_t *info, int raise)
|
||||||
info->monotonic = 0;
|
info->monotonic = 0;
|
||||||
info->adjustable = 1;
|
info->adjustable = 1;
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
#endif /* HAVE_GETTIMEOFDAY */
|
|
||||||
#endif /* !HAVE_CLOCK_GETTIME */
|
#endif /* !HAVE_CLOCK_GETTIME */
|
||||||
#endif /* !MS_WINDOWS */
|
#endif /* !MS_WINDOWS */
|
||||||
|
assert(0 <= tp->tv_usec && tp->tv_usec < 1000 * 1000);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue