summaryrefslogtreecommitdiff
path: root/doc/string_ops.rst
diff options
context:
space:
mode:
Diffstat (limited to 'doc/string_ops.rst')
-rw-r--r--doc/string_ops.rst17
1 files changed, 10 insertions, 7 deletions
diff --git a/doc/string_ops.rst b/doc/string_ops.rst
index 9bb711f..d818d2d 100644
--- a/doc/string_ops.rst
+++ b/doc/string_ops.rst
@@ -456,17 +456,20 @@ Conversion from/to human-readable durations with units
#include <libHX/string.h>
unsigned long long HX_strtoull_sec(const char *s, char **end);
+ unsigned long long HX_strtoull_nsec(const char *s, char **end);
char *HX_unit_seconds(char *out, size_t outsize,
unsigned long long seconds,
unsigned int flags);
-``HX_strtoull_sec`` converts a time duration with units, such as ``"15min30s"``
-into an all-seconds value. The recognized unit strings are: ``years``,
-``year``, ``y``, ``months``, ``month``, ``days``, ``day``, ``d``, ``hours``,
-``hour``, ``h``, ``minutes``, ``minute``, ``min``, ``seconds``, ``second``,
-``s`` and the empty string (for seconds). When parsing stops at any point,
-``*end`` is set to the location, similar to how the ``strtoull`` C function
-would.
+``HX_strtoull_sec`` and ``HX_strtoull_nsec`` convert a time duration with
+units, such as ``"15min30s"`` into an all-seconds and all-nanoseconds value,
+respectively. The recognized unit strings are: ``years``, ``year``, ``y``,
+``months``, ``month``, ``days``, ``day``, ``d``, ``hours``, ``hour``, ``h``,
+``minutes``, ``minute``, ``min``, ``seconds``, ``second``, ``s``, the empty
+string (to mean seconds), ``msec``, ``ms``, ``µsec``, ``µs``, ``nsec`` and
+``ns``. Negative durations are not supported. Support for fractions is
+implementation-defined. When parsing stops at any point, ``*end`` is set to the
+location, similar to how the ``strtoull`` C function would.
One year is defined to be 365.25 days of 86400 seconds; one month is defined to
be 1/12 such a year. This is consistent with the units employed by systemd.