@@ -8,24 +8,24 @@ PyTime C API
88PyTime API
99----------
1010
11- The PyTime_t API is written to use timestamp and timeout values stored in
12- various formats and to read clocks with a resolution of one nanosecond.
13-
14- The :c:type: `PyTime_t ` type is signed to support negative timestamps. The
15- supported range is around [-292.3 years; +292.3 years]. Using the Unix epoch
16- (January 1st, 1970) as reference, the supported date range is around
17- [1677-09-21; 2262-04-11].
11+ The PyTime API provides access to system clocks and time conversion functions.
12+ It is similar to the Python :mod: `time ` module.
1813
1914
2015Types
2116-----
2217
2318.. c :type :: PyTime_t
2419
25- Timestamp type with subsecond precision: 64-bit signed integer.
20+ A timestamp or duration in nanoseconds represented as a 64-bit signed
21+ integer.
22+
23+ The reference point for timestamps depends on the clock used. For example,
24+ :c:func: `PyTime_Time ` returns timestamps relative to the UNIX epoch.
2625
27- This type can be used to store a duration. Indirectly, it can be used to
28- store a date relative to a reference date, such as the UNIX epoch.
26+ The supported range is around [-292.3 years; +292.3 years]. Using the Unix
27+ epoch (January 1st, 1970) as reference, the supported date range is around
28+ [1677-09-21; 2262-04-11].
2929
3030
3131Constants
@@ -56,48 +56,35 @@ Functions
5656
5757.. c:function:: PyTime_t PyTime_Monotonic(void)
5858
59- Get the monotonic clock: clock that cannot go backwards.
60-
61- The monotonic clock is not affected by system clock updates. The reference
62- point of the returned value is undefined, so that only the difference
63- between the results of consecutive calls is valid.
59+ Return the value in nanoseconds of a monotonic clock, i.e. a clock
60+ that cannot go backwards. Similar to :func:`time.monotonic_ns`; see
61+ :func: `time.monotonic ` for details.
6462
65- If reading the clock fails, silently ignore the error and return 0 .
63+ If reading the clock fails, silently ignore the error and return `` 0 `` .
6664
6765 On integer overflow, silently ignore the overflow and clamp the clock to
6866 the ``[PyTime_MIN; PyTime_MAX] `` range.
6967
70- See also the :func: `time.monotonic ` function.
71-
7268
7369.. c :function :: PyTime_t PyTime_PerfCounter (void)
7470
75- Get the performance counter: clock with the highest available resolution to
76- measure a short duration.
71+ Return the value in nanoseconds of a performance counter, i.e. a
72+ clock with the highest available resolution to measure a short duration.
73+ Similar to :func:`time.perf_counter_ns`; see :func:`time.perf_counter` for
74+ details.
7775
78- The performance counter does include time elapsed during sleep and is
79- system-wide. The reference point of the returned value is undefined, so that
80- only the difference between the results of two calls is valid.
81-
82- If reading the clock fails, silently ignore the error and return 0.
76+ If reading the clock fails, silently ignore the error and return ``0 ``.
8377
8478 On integer overflow, silently ignore the overflow and clamp the clock to
8579 the ``[PyTime_MIN; PyTime_MAX] `` range.
8680
87- See also the :func: `time.perf_counter ` function.
88-
8981
9082.. c :function :: PyTime_t PyTime_Time (void)
9183
92- Get the system clock.
93-
94- The system clock can be changed automatically (e.g. by a NTP daemon) or
95- manually by the system administrator. So it can also go backward. Use
96- :c:func:`PyTime_Monotonic` to use a monotonic clock.
84+ Return the time in nanoseconds since the epoch_. Similar to
85+ :func:`time.time_ns`; see :func:`time.time` for details.
9786
9887 If reading the clock fails, silently ignore the error and return ``0 ``.
9988
10089 On integer overflow, silently ignore the overflow and clamp the clock to
10190 the ``[PyTime_MIN; PyTime_MAX] `` range.
102-
103- See also the :func: `time.time ` function.
0 commit comments