Victor Stinner
b8d016955a
Fix clock_gettime/getres/settime: PyArg_ParseTuple() expects an int
...
Only use a single #ifdef for the 3 functions.
2012-04-13 23:44:05 +02:00
Victor Stinner
30d79471bb
Expose clock_settime() as time.clock_settime()
2012-04-03 00:45:07 +02:00
Victor Stinner
1470f35bc6
Add time.CLOCK_HIGHRES constant, needed on Solaris
2012-04-03 00:31:17 +02:00
Victor Stinner
ad95c2d25c
time.time() now uses clock_gettime(CLOCK_REALTIME) if available
...
clock_gettime(CLOCK_REALTIME) has a better resolution than gettimeofday().
time.time() falls back on gettimeofday() (and then on other functions) on
error.
2012-03-28 02:54:15 +02:00
Victor Stinner
74eb6c0e8b
Document the fact that mach_timebase_info() cannot fail
...
And call mach_absolute_time() after mach_timebase_info().
2012-03-28 02:50:46 +02:00
Victor Stinner
8486076dd5
Fix time.steady(strict=True): don't use CLOCK_REALTIME
2012-03-26 22:53:14 +02:00
Victor Stinner
70b2e1e7d9
Issue #14368 : _PyTime_gettimeofday() cannot fail
...
floattime() must not raise an error if the current time is 1970.1.1 at 00:00.
2012-03-26 22:08:02 +02:00
Victor Stinner
071eca3f5c
Issue #10278 : Add an optional strict argument to time.steady(), False by default
2012-03-15 01:17:09 +01:00
Victor Stinner
ec919cc74d
Issue #10278 : Drop time.monotonic() function, rename time.wallclock() to time.steady()
...
* On Mac OS X, time.steady() now uses mach_absolute_time(), a monotonic clock
* Optimistic change: bet that CLOCK_MONOTONIC and CLOCK_REALTIME are available
when clock_gettime() is available
* Rewrite time.steady() documentation
2012-03-15 00:58:32 +01:00
Victor Stinner
5d272cc6a2
Close #14180 : Factorize code to convert a number of seconds to time_t, timeval or timespec
...
time.ctime(), gmtime(), time.localtime(), datetime.date.fromtimestamp(),
datetime.datetime.fromtimestamp() and datetime.datetime.utcfromtimestamp() now
raises an OverflowError, instead of a ValueError, if the timestamp does not fit
in time_t.
datetime.datetime.fromtimestamp() and datetime.datetime.utcfromtimestamp() now
round microseconds towards zero instead of rounding to nearest with ties going
away from zero.
2012-03-13 13:35:55 +01:00
Victor Stinner
a8ec5ea923
Issue #14104 : Implement time.monotonic() on Mac OS X,
...
patch written by Nicholas Riley.
2012-03-13 00:25:42 +01:00
Stefan Krah
4aea7d3811
Issue #14125 : Fix refleak in timemodule.c on Windows. Thanks sbt for pointing
...
out the location of the problem. MS_WINDOWS currently implies !HAVE_WCSFTIME,
so the addition of !defined(HAVE_WCSFTIME) is for readability.
2012-02-27 16:30:26 +01:00
Victor Stinner
4195b5caea
Backout f8409b3d6449: the PEP 410 is not accepted yet
2012-02-08 23:03:19 +01:00
Victor Stinner
ccd5715a14
PEP 410
2012-02-08 14:31:50 +01:00
Victor Stinner
8b30201f7d
Issue #13846 : Add time.monotonic(), monotonic clock.
2012-02-07 23:29:46 +01:00
Victor Stinner
85fdfa85e1
Issue #13847 : time.clock() now raises a RuntimeError if the processor time used
...
is not available or its value cannot be represented
2012-01-27 00:38:48 +01:00
Victor Stinner
c1b5d34ede
Issue #13847 : time.localtime() and time.gmtime() now raise an OSError instead
...
of ValueError on failure. time.ctime() and time.asctime() now raises an
OSError if localtime() failed.
2012-01-27 00:08:48 +01:00
Antoine Pitrou
e39ebe45c4
Merge
2012-01-18 02:05:38 +01:00
Victor Stinner
855889b4bf
Issue #10278 : fix a typo in the doc
2012-01-18 01:57:19 +01:00
Victor Stinner
b94b266cfc
Close #10278 : Add time.wallclock() function, monotonic clock.
2012-01-18 01:50:21 +01:00
Antoine Pitrou
2c085604b7
Fix error handling in timemodule.c
2012-01-18 01:41:44 +01:00
Victor Stinner
ab870218e3
Issue #10951 : Fix compiler warnings in timemodule.c and unicodeobject.c
...
Thanks Jérémy Anger for the fix.
2011-12-17 22:39:43 +01:00
Victor Stinner
136ea49b39
Issue #10951 : Fix a compiler warning in timemodule.c
2011-12-17 22:37:18 +01:00
Victor Stinner
1b57967b96
Issue #13560 : Locale codec functions use the classic "errors" parameter,
...
instead of surrogateescape
So it would be possible to support more error handlers later.
2011-12-17 05:47:23 +01:00
Victor Stinner
f2ea71fcc8
Issue #13560 : Add PyUnicode_EncodeLocale()
...
* Use PyUnicode_EncodeLocale() in time.strftime() if wcsftime() is not
available
* Document my last changes in Misc/NEWS
2011-12-17 04:13:41 +01:00
Victor Stinner
af02e1c85a
Add PyUnicode_DecodeLocaleAndSize() and PyUnicode_DecodeLocale()
...
* PyUnicode_DecodeLocaleAndSize() and PyUnicode_DecodeLocale() decode a string
from the current locale encoding
* _Py_char2wchar() writes an "error code" in the size argument to indicate
if the function failed because of memory allocation failure or because of a
decoding error. The function doesn't write the error message directly to
stderr.
* Fix time.strftime() (if wcsftime() is missing): decode strftime() result
from the current locale encoding, not from the filesystem encoding.
2011-12-16 23:56:01 +01:00
Antoine Pitrou
ab0e9f7089
Issue #10350 : Read and save errno before calling a function which might overwrite it.
...
Original patch by Hallvard B Furuseth.
2011-12-16 12:29:37 +01:00
Antoine Pitrou
c345ce1a69
Issue #10350 : Read and save errno before calling a function which might overwrite it.
...
Original patch by Hallvard B Furuseth.
2011-12-16 12:28:32 +01:00
Victor Stinner
db6238964d
(Merge 3.2) Issue #5905 : time.strftime() is now using the locale encoding,
...
instead of UTF-8, if the wcsftime() function is not available.
2011-12-09 20:21:17 +01:00
Victor Stinner
720f34a3e8
Issue #5905 : time.strftime() is now using the locale encoding, instead of
...
UTF-8, if the wcsftime() function is not available.
2011-12-09 20:19:24 +01:00
Antoine Pitrou
6dd381eb62
Issue #12328 : Under Windows, refactor handling of Ctrl-C events and
...
make _multiprocessing.win32.WaitForMultipleObjects interruptible when
the wait_flag parameter is false. Patch by sbt.
2011-11-21 21:26:56 +01:00
Victor Stinner
e0be423297
Close #10278 : Add clock_getres(), clock_gettime() and CLOCK_xxx constants to
...
the time module. time.clock_gettime(time.CLOCK_MONOTONIC) provides a monotonic
clock
2011-10-25 13:06:09 +02:00
Victor Stinner
5a3ff79fd6
Issue #10653 : Fix time.strftime() on Windows, check for invalid format strings
2011-10-16 19:08:23 +02:00
Martin v. Löwis
bd928fef42
Rename _Py_identifier to _Py_IDENTIFIER.
2011-10-14 10:20:37 +02:00
Victor Stinner
792b47f6ca
(Merge 3.2) Issue #10653 : On Windows, use strftime() instead of wcsftime()
...
because wcsftime() doesn't format time zone correctly.
2011-10-14 02:39:06 +02:00
Victor Stinner
c1f32ca0ad
Issue #10653 : On Windows, use strftime() instead of wcsftime() because
...
wcsftime() doesn't format time zone correctly.
2011-10-14 02:36:13 +02:00
Martin v. Löwis
afe55bba33
Add API for static strings, primarily good for identifiers.
...
Thanks to Konrad Schöbel and Jasper Schulz for helping with the mass-editing.
2011-10-09 10:38:36 +02:00
Victor Stinner
8d91d454d5
Issue #10653 : Fix time.strftime() on Windows, check for invalid format strings
2011-10-16 23:45:39 +02:00
Victor Stinner
7f53a5027d
Issue #12459 : time.sleep() now raises a ValueError if the sleep length is
...
negative, instead of an infinite sleep on Windows or raising an IOError on
Linux for example, to have the same behaviour on all platforms.
2011-07-05 22:00:25 +02:00
Victor Stinner
99b9538636
Issue #9642 : Uniformize the tests on the availability of the mbcs codec
...
Add a new HAVE_MBCS define.
2011-07-04 14:23:54 +02:00
Victor Stinner
9122fdd8fa
Issue #9642 : Fix the definition of time.clock() on Windows
...
Don't unset and set againt the HAVE_CLOCK define, reorder the #if tests
instead. Fix also the definition of the timezone encoding.
2011-07-04 13:55:40 +02:00
Victor Stinner
48b1ce5519
Issue #12462 : time.sleep() now calls immediatly the (Python) signal handler if
...
it is interrupted by a signal, instead of having to wait until the next
instruction.
Patch reviewed by Antoine Pitrou.
2011-07-01 13:50:09 +02:00
Alexander Belopolsky
66746cb222
Removed unused variable
2011-05-02 13:44:20 -04:00
Alexander Belopolsky
03163ac185
Issue #11930 : Remove deprecated time.accept2dyear.
2011-05-02 12:20:52 -04:00
Senthil Kumaran
736975a771
merge from 3.2
2011-04-06 14:16:08 +08:00
Senthil Kumaran
ae664fb528
Merge from 3.1
2011-04-06 14:11:09 +08:00
Senthil Kumaran
8f377a3bbe
Issue #10762 : Guard against invalid/non-supported format string '%f' on Windows. Patch Santoso Wijaya.
2011-04-06 12:54:06 +08:00
Victor Stinner
499dfcf29d
Issue #10833 : Use PyUnicode_FromFormat() and PyErr_Format() instead of
...
PyOS_snprintf().
2011-03-21 13:26:24 +01:00
Victor Stinner
6f0e4f99ab
time.strftime(): replace PyErr_Format() by PyErr_SetString()
...
The argument was not used in the format string.
2011-03-21 02:14:53 +01:00
Ezio Melotti
3b3499ba69
#11565 : Merge with 3.1.
2011-03-16 11:35:38 +02:00