aboutsummaryrefslogtreecommitdiff
path: root/docs/src
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2023-04-27 22:13:46 +0200
committerGitHub <noreply@github.com>2023-04-27 22:13:46 +0200
commitc8a1e6132bf377ea84c7e1e9c840691ef4999a07 (patch)
treee897db8718fa8a11d28e10a7cc7b8a0c8b6b4b2d /docs/src
parente02642cf3b768b2c58a41f97fa38507e032ae415 (diff)
downloadlibuv-c8a1e6132bf377ea84c7e1e9c840691ef4999a07.tar.gz
libuv-c8a1e6132bf377ea84c7e1e9c840691ef4999a07.zip
unix,win: add uv_clock_gettime() (#3971)
Fixes: https://github.com/libuv/libuv/issues/1674
Diffstat (limited to 'docs/src')
-rw-r--r--docs/src/fs.rst3
-rw-r--r--docs/src/misc.rst42
2 files changed, 41 insertions, 4 deletions
diff --git a/docs/src/fs.rst b/docs/src/fs.rst
index e7522d59..891ee74c 100644
--- a/docs/src/fs.rst
+++ b/docs/src/fs.rst
@@ -30,7 +30,8 @@ Data types
.. c:type:: uv_timespec_t
- Portable equivalent of ``struct timespec``.
+ Y2K38-unsafe data type for storing times with nanosecond resolution.
+ Will be replaced with :c:type:`uv_timespec64_t` in libuv v2.0.
::
diff --git a/docs/src/misc.rst b/docs/src/misc.rst
index e8b9a4c8..c2ad5804 100644
--- a/docs/src/misc.rst
+++ b/docs/src/misc.rst
@@ -73,7 +73,8 @@ Data types
.. c:type:: uv_timeval_t
- Data type for storing times.
+ Y2K38-unsafe data type for storing times with microsecond resolution.
+ Will be replaced with :c:type:`uv_timeval64_t` in libuv v2.0.
::
@@ -84,7 +85,7 @@ Data types
.. c:type:: uv_timeval64_t
- Alternative data type for storing times.
+ Y2K38-safe data type for storing times with microsecond resolution.
::
@@ -93,6 +94,28 @@ Data types
int32_t tv_usec;
} uv_timeval64_t;
+.. c:type:: uv_timespec64_t
+
+ Y2K38-safe data type for storing times with nanosecond resolution.
+
+ ::
+
+ typedef struct {
+ int64_t tv_sec;
+ int32_t tv_nsec;
+ } uv_timespec64_t;
+
+.. c:enum:: uv_clock_id
+
+ Clock source for :c:func:`uv_clock_gettime`.
+
+ ::
+
+ typedef enum {
+ UV_CLOCK_MONOTONIC,
+ UV_CLOCK_REALTIME
+ } uv_clock_id;
+
.. c:type:: uv_rusage_t
Data type for resource usage results.
@@ -588,7 +611,7 @@ API
.. c:function:: uint64_t uv_hrtime(void)
- Returns the current high-resolution real time. This is expressed in
+ Returns the current high-resolution timestamp. This is expressed in
nanoseconds. It is relative to an arbitrary time in the past. It is not
related to the time of day and therefore not subject to clock drift. The
primary use is for measuring performance between intervals.
@@ -597,6 +620,19 @@ API
Not every platform can support nanosecond resolution; however, this value will always
be in nanoseconds.
+.. c:function:: int uv_clock_gettime(uv_clock_id clock_id, uv_timespec64_t* ts)
+
+ Obtain the current system time from a high-resolution real-time or monotonic
+ clock source.
+
+ The real-time clock counts from the UNIX epoch (1970-01-01) and is subject
+ to time adjustments; it can jump back in time.
+
+ The monotonic clock counts from an arbitrary point in the past and never
+ jumps back in time.
+
+ .. versionadded:: 1.45.0
+
.. c:function:: void uv_print_all_handles(uv_loop_t* loop, FILE* stream)
Prints all handles associated with the given `loop` to the given `stream`.