File tree 3 files changed +30
-6
lines changed
3 files changed +30
-6
lines changed Original file line number Diff line number Diff line change @@ -840,6 +840,15 @@ These constants are used as parameters for :func:`clock_getres` and
840
840
841
841
.. versionadded :: 3.3
842
842
843
+ .. data :: CLOCK_MONOTONIC_RAW_APPROX
844
+
845
+ Similar to :data: `CLOCK_MONOTONIC_RAW `, but reads a value cached by
846
+ the system at context switch and hence has less accuracy.
847
+
848
+ .. availability :: macOS >= 10.12.
849
+
850
+ .. versionadded :: 3.13
851
+
843
852
844
853
.. data :: CLOCK_PROCESS_CPUTIME_ID
845
854
@@ -899,6 +908,15 @@ These constants are used as parameters for :func:`clock_getres` and
899
908
900
909
.. versionadded :: 3.8
901
910
911
+ .. data :: CLOCK_UPTIME_RAW_APPROX
912
+
913
+ Like :data: `CLOCK_UPTIME_RAW `, but the value is cached by the system
914
+ at context switches and therefore has less accuracy.
915
+
916
+ .. availability :: macOS >= 10.12.
917
+
918
+ .. versionadded :: 3.13
919
+
902
920
The following constant is the only parameter that can be sent to
903
921
:func: `clock_settime `.
904
922
Original file line number Diff line number Diff line change
1
+ Add ``CLOCK_MONOTONIC_RAW_APPROX `` and ``CLOCK_UPTIME_RAW_APPROX `` to
2
+ :mod: `time ` on macOS. These are clocks available on macOS 10.12 or later.
Original file line number Diff line number Diff line change @@ -1993,20 +1993,16 @@ time_exec(PyObject *module)
1993
1993
return -1 ;
1994
1994
}
1995
1995
#endif
1996
-
1997
1996
#ifdef CLOCK_MONOTONIC
1998
-
1999
1997
if (PyModule_AddIntMacro (module , CLOCK_MONOTONIC ) < 0 ) {
2000
1998
return -1 ;
2001
1999
}
2002
-
2003
2000
#endif
2004
2001
#ifdef CLOCK_MONOTONIC_RAW
2005
2002
if (PyModule_AddIntMacro (module , CLOCK_MONOTONIC_RAW ) < 0 ) {
2006
2003
return -1 ;
2007
2004
}
2008
2005
#endif
2009
-
2010
2006
#ifdef CLOCK_HIGHRES
2011
2007
if (PyModule_AddIntMacro (module , CLOCK_HIGHRES ) < 0 ) {
2012
2008
return -1 ;
@@ -2017,7 +2013,6 @@ time_exec(PyObject *module)
2017
2013
return -1 ;
2018
2014
}
2019
2015
#endif
2020
-
2021
2016
#ifdef CLOCK_THREAD_CPUTIME_ID
2022
2017
if (PyModule_AddIntMacro (module , CLOCK_THREAD_CPUTIME_ID ) < 0 ) {
2023
2018
return -1 ;
@@ -2044,10 +2039,19 @@ time_exec(PyObject *module)
2044
2039
}
2045
2040
#endif
2046
2041
#ifdef CLOCK_UPTIME_RAW
2047
-
2048
2042
if (PyModule_AddIntMacro (module , CLOCK_UPTIME_RAW ) < 0 ) {
2049
2043
return -1 ;
2050
2044
}
2045
+ #endif
2046
+ #ifdef CLOCK_MONOTONIC_RAW_APPROX
2047
+ if (PyModule_AddIntMacro (module , CLOCK_MONOTONIC_RAW_APPROX ) < 0 ) {
2048
+ return -1 ;
2049
+ }
2050
+ #endif
2051
+ #ifdef CLOCK_UPTIME_RAW_APPROX
2052
+ if (PyModule_AddIntMacro (module , CLOCK_UPTIME_RAW_APPROX ) < 0 ) {
2053
+ return -1 ;
2054
+ }
2051
2055
#endif
2052
2056
}
2053
2057
You can’t perform that action at this time.
0 commit comments