diff -r 3df2f4a83816 Doc/library/time.rst --- a/Doc/library/time.rst Thu Apr 12 21:40:14 2012 +0200 +++ b/Doc/library/time.rst Thu Apr 12 22:23:14 2012 +0200 @@ -158,6 +158,17 @@ The module defines the following functio .. versionadded:: 3.3 +.. data:: CLOCK_BOOTTIME + + CLOCK_BOOTTIME is identical to :data:`CLOCK_MONOTONIC`, except it also + includes any time spent in suspend. This allows applications to get a + suspend aware monotonic clock. + + Available on Linux 2.6.39 or later. + + .. versionadded:: 3.3 + + .. data:: CLOCK_HIGHRES The Solaris OS has a CLOCK_HIGHRES timer that attempts to use an optimal @@ -175,6 +186,17 @@ The module defines the following functio .. versionadded:: 3.3 +.. data:: CLOCK_MONOTONIC_COARSE +.. data:: CLOCK_MONOTONIC_FAST + + Very fast but not fine-grained version of :data:`CLOCK_MONOTONIC`. + + :data:`CLOCK_MONOTONIC_COARSE` is available on Linux 2.6.32 or later, + :data:`CLOCK_MONOTONIC_FAST` is available on FreeBSD 8 or later. + + .. versionadded:: 3.3 + + .. data:: CLOCK_MONOTONIC_RAW Similar to :data:`CLOCK_MONOTONIC`, but provides access to a raw @@ -192,6 +214,15 @@ The module defines the following functio .. versionadded:: 3.3 +.. data:: CLOCK_PROF + + Time that increments when the CPU is running in user or kernel mode. + + Availability: BSD. + + .. versionadded:: 3.3 + + .. data:: CLOCK_REALTIME System-wide real-time clock. Setting this clock requires appropriate @@ -200,6 +231,27 @@ The module defines the following functio .. versionadded:: 3.3 +.. data:: CLOCK_REALTIME_COARSE +.. data:: CLOCK_REALTIME_FAST + + Very fast but not fine-grained version of :data:`CLOCK_REALTIME`. + + :data:`CLOCK_REALTIME_COARSE` is available on Linux 2.6.32 or later, + :data:`CLOCK_REALTIME_FAST` is available on FreeBSD 8 or later. + + .. versionadded:: 3.3 + + +.. data:: CLOCK_SECOND + + Return the current second without performing a full time counter query, + using in-kernel cached value of current second. + + Availability: FreeBSD. + + .. versionadded:: 3.3 + + .. data:: CLOCK_THREAD_CPUTIME_ID Thread-specific CPU-time clock. @@ -207,6 +259,26 @@ The module defines the following functio .. versionadded:: 3.3 +.. data:: CLOCK_UPTIME + + Start at zero when the kernel boots and increment monotonically in SI + seconds while the machine is running. + + Availability: BSD. + + .. versionadded:: 3.3 + + +.. data:: CLOCK_VIRTUAL + + Time that increments only when the CPU is running in user mode on behalf of + the calling process. + + Availability: BSD. + + .. versionadded:: 3.3 +.. data::CLOCK_BOOTTIME_ALARM + + CLOCK_BOOTTIME_ALARM is exactly like CLOCK_BOOTTIME + except it also wakes suspended system. + + Availability: Linux 3.0 and later +.. data::CLOCK_REALTIME_ALARM + + CLOCK_REALTIME_ALARM is exactly like CLOCK_REALTIME + except it also wakes suspended system. + + Availability: Linux 3.0 and later + .. function:: ctime([secs]) Convert a time expressed in seconds since the epoch to a string representing diff -r 3df2f4a83816 Modules/timemodule.c --- a/Modules/timemodule.c Thu Apr 12 21:40:14 2012 +0200 +++ b/Modules/timemodule.c Thu Apr 12 22:23:14 2012 +0200 @@ -983,9 +983,21 @@ PyInit_timezone(PyObject *m) { #ifdef CLOCK_REALTIME PyModule_AddIntMacro(m, CLOCK_REALTIME); #endif +#ifdef CLOCK_REALTIME_COARSE + PyModule_AddIntMacro(m, CLOCK_REALTIME_COARSE); +#endif +#ifdef CLOCK_REALTIME_FAST + PyModule_AddIntMacro(m, CLOCK_REALTIME_FAST); +#endif #ifdef CLOCK_MONOTONIC PyModule_AddIntMacro(m, CLOCK_MONOTONIC); #endif +#ifdef CLOCK_MONOTONIC_COARSE + PyModule_AddIntMacro(m, CLOCK_MONOTONIC_COARSE); +#endif +#ifdef CLOCK_MONOTONIC_FAST + PyModule_AddIntMacro(m, CLOCK_MONOTONIC_FAST); +#endif #ifdef CLOCK_MONOTONIC_RAW PyModule_AddIntMacro(m, CLOCK_MONOTONIC_RAW); #endif @@ -998,6 +1010,21 @@ PyInit_timezone(PyObject *m) { #ifdef CLOCK_THREAD_CPUTIME_ID PyModule_AddIntMacro(m, CLOCK_THREAD_CPUTIME_ID); #endif +#ifdef CLOCK_BOOTTIME + PyModule_AddIntMacro(m, CLOCK_BOOTTIME); +#endif +#ifdef CLOCK_UPTIME + PyModule_AddIntMacro(m, CLOCK_UPTIME); +#endif +#ifdef CLOCK_PROF + PyModule_AddIntMacro(m, CLOCK_PROF); +#endif +#ifdef CLOCK_SECOND + PyModule_AddIntMacro(m, CLOCK_SECOND); +#endif +#ifdef CLOCK_VIRTUAL + PyModule_AddIntMacro(m, CLOCK_VIRTUAL); +#endif #endif /* HAVE_CLOCK_GETTIME */ }