Message156334
| Author |
vstinner |
| Recipients |
vstinner |
| Date |
2012年03月19日.12:28:49 |
| SpamBayes Score |
1.1568757e-10 |
| Marked as misclassified |
No |
| Message-id |
<1332160130.55.0.774132301526.issue14368@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
floattime() raises an OSError if _PyTime_gettimeofday() returns secs=0 and usec=0. This is wrong because _PyTime_gettimeofday() cannot fail and secs=0 is valid if the current time is 0 (1970年1月1日 at 12:00 UTC). Extract of _PyTime_gettimeofday() "doc":
/* 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);
In practice, I suppose that nobody noticed the bug because we are in 2012, not in 1969 :-) And even if you change your system clock to 19691131, you may not be able to reproduce the bug because you have to call gettimeofday() exactly at midnight to get also usec=0 ...
Attached patch removes the exception. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2012年03月19日 12:28:50 | vstinner | set | recipients:
+ vstinner |
| 2012年03月19日 12:28:50 | vstinner | set | messageid: <1332160130.55.0.774132301526.issue14368@psf.upfronthosting.co.za> |
| 2012年03月19日 12:28:49 | vstinner | link | issue14368 messages |
| 2012年03月19日 12:28:49 | vstinner | create |
|