skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

commit 351aae58f2c73749a12e2b19cbb447614a2ee3ff
parent 61b4199fe43e94d6753290a62eb45363503e0deb
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date:   Tue, 27 Sep 2022 08:49:04 +0000

 Doc fixes: remove _t from skalibs types

Signed-off-by: Laurent Bercot <ska@appnovation.com>

Diffstat:
Mdoc/libstddjb/alarm.html | 6+++---
Mdoc/libstddjb/allreadwrite.html | 12++++++------
Mdoc/libstddjb/djbtime.html | 32++++++++++++++++----------------
Mdoc/libstddjb/djbunix.html | 4++--
Mdoc/libstddjb/iopause.html | 6+++---
Mdoc/libstddjb/ip46.html | 6+++---
Mdoc/libstddjb/tai.html | 122++++++++++++++++++++++++++++++++++++++++----------------------------------------
7 files changed, 94 insertions(+), 94 deletions(-)

diff --git a/doc/libstddjb/alarm.html b/doc/libstddjb/alarm.html @@ -54,17 +54,17 @@ Returns 1 on success and 0 (and sets errno) on failure. </p> <p> -<code> int alarm_timeout (tain_t const *tto) </code> <br /> +<code> int alarm_timeout (tain const *tto) </code> <br /> Sets a fuse that will raise a SIGALRM after some amount of time has passed. The amount of time is described in *<em>tto</em>, which is a relative -<a href="tai.html">tain_t</a>, i.e. a structure containing +<a href="tai.html">tain</a>, i.e. a structure containing a relative TAIN64 time. Returns 1 on success and 0 (and sets errno) on failure. </p> <p> -<code> int alarm_deadline (tain_t const *deadline) </code> <br /> +<code> int alarm_deadline (tain const *deadline) </code> <br /> Sets a fuse that will raise a SIGALRM when the clock reaches *<em>deadline</em>, which is an absolute time expressed in <a href="tai.html">TAI64N</a> format. diff --git a/doc/libstddjb/allreadwrite.html b/doc/libstddjb/allreadwrite.html @@ -44,7 +44,7 @@ use higher-level APIs such as <a href="buffer.html">buffer</a> and <h2> Function types </h2> <p> -<code> typedef ssize_t iofunc_t (int fd, char *buf, size_t len) </code> <br /> +<code> typedef ssize_t io_func (int fd, char *buf, size_t len) </code> <br /> This is the simplified type of IO functions such as <a href="https://www.opengroup.org/onlinepubs/9699919799/functions/read.html">read()</a> and @@ -52,7 +52,7 @@ and </p> <p> -<code> typedef ssize_t iovfunc_t (int fd, struct iovec const *v, unsigned int vlen) </code> <br /> +<code> typedef ssize_t iov_func (int fd, struct iovec const *v, unsigned int vlen) </code> <br /> This is the simplified type of IO functions such as <a href="https://www.opengroup.org/onlinepubs/9699919799/functions/readv.html">readv()</a> and @@ -64,7 +64,7 @@ elements instead of a single string. <p> -<code> typedef size_t alliofunc_t (int fd, char *buf, size_t len) </code> <br /> +<code> typedef size_t allio_func (int fd, char *buf, size_t len) </code> <br /> This is the type of an IO operation that expects <em>all</em> of its <em>len</em> bytes to be sent or received, and that will loop around a lower-level IO function until either <em>len</em> bytes have been @@ -100,7 +100,7 @@ Returns the inverse of <code>sanitize_read</code>. </p> <p> -<code> size_t allreadwrite (iofunc_t *f, int fd, char *s, size_t len) </code> <br /> +<code> size_t allreadwrite (io_func *f, int fd, char *s, size_t len) </code> <br /> *<em>f</em> must be a basic reading or writing function such as <tt>fd_read</tt> or <tt>fd_write</tt>. <tt>allreadwrite()</tt> performs *<em>f</em> on <em>fd</em>, <em>s</em> and <em>len</em> until <em>len</em> @@ -112,7 +112,7 @@ set errno to EWOULDBLOCK or EAGAIN. </p> <p> -<code> size_t allreadwritev (iovfunc_t *f, int fd, struct iovec const *v, unsigned int vlen) </code> <br /> +<code> size_t allreadwritev (iov_func *f, int fd, struct iovec const *v, unsigned int vlen) </code> <br /> Like <code> allreadwrite </code> but the content to perform IO on is specified as a <a href="siovec.html">scatter/gather array</a> of <em>vlen</em> @@ -171,7 +171,7 @@ an error occurs. <p> <code> size_t allwrite (int fd, char const *s, size_t len) </code> <br /> -Equivalent to <code> allreadwrite((iofunc_t *)&amp;fd_write, fd, s, len) </code>: +Equivalent to <code> allreadwrite((io_func *)&amp;fd_write, fd, s, len) </code>: attempts to write <em>len</em> bytes from <em>s</em> to <em>fd</em>, looping around <tt>fd_write()</tt> if necessary, until either <em>len</em> bytes are written or an error occurs. diff --git a/doc/libstddjb/djbtime.html b/doc/libstddjb/djbtime.html @@ -29,7 +29,7 @@ and implemented in the <tt>libskarnet.a</tt> or <tt>libskarnet.so</tt> library. <p> <tt>djbtime</tt> is a set of functions to convert -<a href="tai.html">tai_t and tain_t</a> structures, and +<a href="tai.html">tai and tain</a> structures, and <a href="https://cr.yp.to/libtai/tai64.html">TAI time</a>, from and to other time formats and user-friendly representations. </p> @@ -37,13 +37,13 @@ other time formats and user-friendly representations. <h2> Data structures </h2> <ul> - <li> TAI time with 1-second precision is represented as a <a href="tai.html">tai_t</a>. </li> - <li> TAI time with more precision is represented as a <a href="tai.html">tain_t</a>. </li> + <li> TAI time with 1-second precision is represented as a <a href="tai.html">tai</a>. </li> + <li> TAI time with more precision is represented as a <a href="tai.html">tain</a>. </li> <li> UTC time is represented as an unsigned 64-bit integer equal to 2^62 added to the number of seconds since the Epoch. It's a trivial extension of the standard 32-bit Unix time that will expire in 2038. </li> <li> Broken-down GMT or local time with more than a 1-second precision is stored in a -<tt>localtmn_t</tt> structure, containing a <tt>struct tm</tt> <em>tm</em> +<tt>localtmn</tt> structure, containing a <tt>struct tm</tt> <em>tm</em> field and an unsigned long <em>nano</em> field. </li> </ul> @@ -52,7 +52,7 @@ field and an unsigned long <em>nano</em> field. </li> <h3> UTC </h3> <p> -<code> int utc_from_tai (uint64_t *u, tai_t const *t) </code> <br /> +<code> int utc_from_tai (uint64_t *u, tai const *t) </code> <br /> Converts the absolute TAI64 time in *<em>t</em> to an UTC time, stored in *<em>u</em> as an unsigned 64-bit integer. *<em>u</em> is actually 2^62 plus the number of seconds since the Epoch. @@ -62,7 +62,7 @@ returns 2 instead of 1. </p> <p> -<code> int tai_from_utc (tai_t *t, uint64_t u) </code> <br /> +<code> int tai_from_utc (tai *t, uint64_t u) </code> <br /> Converts the UTC time in <em>u</em>, stored as an unsigned 64-bit integer (2^62 plus the number of seconds since the Epoch), to a TAI64 time in *<em>t</em>. @@ -73,7 +73,7 @@ error occurs. <h3> NTP </h3> <p> -<code> int ntp_from_tain (uint64_t *ntp, tain_t const *a) </code> <br /> +<code> int ntp_from_tain (uint64_t *ntp, tain const *a) </code> <br /> Converts the absolute TAI64N time in *<em>a</em> to a 64-bit NTP timestamp, stored in *<em>ntp</em>. The higher 32 bits of *<em>ntp</em> represent a number of seconds ; the lower 32 bits are the fractional part of the timestamp. @@ -83,7 +83,7 @@ error occurs (for instance: </p> <p> -<code> int tain_from_ntp (tain_t *a, uint64_t ntp) </code> <br /> +<code> int tain_from_ntp (tain *a, uint64_t ntp) </code> <br /> Converts the NTP timestamp in <em>ntp</em> to a TAI64N time in *<em>a</em>. The function returns 1 if it succeeds, or 0 (and sets errno) if an @@ -101,7 +101,7 @@ timezone takes leap seconds into account or not. </p> <p> -<code> int localtm_from_tai (struct tm *tm, tai_t const *t, int lo) </code> <br /> +<code> int localtm_from_tai (struct tm *tm, tai const *t, int lo) </code> <br /> Converts the TAI time in *<em>t</em> to broken-down GMT (if <em>lo</em> is zero) or local (if <em>lo</em> is nonzero) time in *<em>tm</em>. @@ -141,7 +141,7 @@ error occurs. </p> <p> -<code> int tai_from_localtm (tai_t *t, struct tm const *tm) </code> <br /> +<code> int tai_from_localtm (tai *t, struct tm const *tm) </code> <br /> Converts the broken-down local time in *<em>tm</em> to a TAI value in *<em>t</em>. The function returns 1 if it succeeds, or 0 (and sets errno) if an @@ -157,11 +157,11 @@ error occurs. </p> <p> - The following functions use the <tt>localtmn_t</tt> type to hold both + The following functions use the <tt>localtmn</tt> type to hold both a broken-down time and a nanosecond count: </p> -<pre>typedef struct localtmn_s localtmn_t, *localtmn_t_ref ; +<pre>typedef struct localtmn_s localtmn, *localtmn_ref ; struct localtmn_s { struct tm tm ; @@ -174,10 +174,10 @@ struct localtmn_s </p> <p> -<code> int localtmn_from_tain (localtmn_t *tmn, tain_t const *a, int lo) ; <br /> -int tain_from_localtmn (tain_t *a, localtmn_t const *tmn) ; <br /> -int localtmn_from_sysclock (localtmn_t *tmn, tain_t const *a, int lo) ; <br /> -int sysclock_from_localtmn (tain_t *a, localtmn_t const *tmn) ; </code> <br /> +<code> int localtmn_from_tain (localtmn *tmn, tain const *a, int lo) ; <br /> +int tain_from_localtmn (tain *a, localtmn const *tmn) ; <br /> +int localtmn_from_sysclock (localtmn *tmn, tain const *a, int lo) ; <br /> +int sysclock_from_localtmn (tain *a, localtmn const *tmn) ; </code> <br /> </p> </body> diff --git a/doc/libstddjb/djbunix.html b/doc/libstddjb/djbunix.html @@ -723,9 +723,9 @@ Returns 0 if it succeeds and -1 (and sets errno) if it fails. <h3> Temporization </h3> <p> -<code> void deepsleepuntil (tain_t const *deadline, tain_t *stamp) </code> <br /> +<code> void deepsleepuntil (tain const *deadline, tain *stamp) </code> <br /> Sleeps until the absolute time represented by the -<a href="tai.html">tain_t</a> *<em>deadline</em>. *<em>stamp</em> +<a href="tai.html">tain</a> *<em>deadline</em>. *<em>stamp</em> must contain the current time. When the function returns, *<em>stamp</em> has been updated to reflect the new current time. </p> diff --git a/doc/libstddjb/iopause.html b/doc/libstddjb/iopause.html @@ -77,7 +77,7 @@ argument, the <tt>iopause()</tt> function uses a <em>deadline</em> argument, i.e. an absolute time at which it must return 0 if no event has happened so far, as well as a <em>stamp</em> argument, i.e. an absolute time meaning <em>now</em>. Those arguments are stored in -<a href="tai.html">tain_t</a>s. Here is why: +<a href="tai.html">tain</a>s. Here is why: </p> <p> @@ -153,7 +153,7 @@ that is why <tt>iopause</tt> relies on the <a href="tai.html">tai</a> library. <h2> Functions </h2> <p> -<code> int iopause (iopause_fd *x, unsigned int len, tain_t const *deadline, tain_t const *stamp) </code> <br /> +<code> int iopause (iopause_fd *x, unsigned int len, tain const *deadline, tain const *stamp) </code> <br /> Blocks until one of the events described in the <em>x</em> array, of length <em>len</em>, happens, or until the absolute date *<em>deadline</em> is reached. <em>deadline</em> may be null, in which case the function blocks @@ -164,7 +164,7 @@ happened, 0 for a timeout, or -1 (and sets errno) for an error. </p> <p> -<code> int iopause_stamp (iopause_fd *x, unsigned int len, tain_t const *deadline, tain_t *stamp) </code> <br /> +<code> int iopause_stamp (iopause_fd *x, unsigned int len, tain const *deadline, tain *stamp) </code> <br /> Like <tt>iopause()</tt>, but if <em>stamp</em> is not null, it is updated right before the function returns. This helps the user always keep a reasonably accurate estimation of the current time in <em>stamp</em>; diff --git a/doc/libstddjb/ip46.html b/doc/libstddjb/ip46.html @@ -114,7 +114,7 @@ Same as the previous function, with the SO_REUSEADDR option. </p> <p> -<code> int socket_deadlineconnstamp46 (int fd, ip46_t const *a, uint16_t port, tain_t const *deadline, tain_t *stamp) </code> <br /> +<code> int socket_deadlineconnstamp46 (int fd, ip46_t const *a, uint16_t port, tain const *deadline, tain *stamp) </code> <br /> Attempts to synchronously connect the socket <em>fd</em> to address a<em>a</em> and port <em>port</em>. Returns 1 if it succeeds and 0 (and sets errno) if it fails. <em>stamp</em> must contain an accurate enough @@ -153,7 +153,7 @@ Returns 0 in case of success, and -1 (and sets errno) in case of failure. <p> <code> ssize_t socket_recvnb46 (int fd, char *s, size_t len, ip46_t *a, uint16_t *port, -tain_t const *deadline, tain_t *stamp) </code> <br /> +tain const *deadline, tain *stamp) </code> <br /> Like <tt>socket_recv46</tt>, except that the function blocks until a datagram is received. *<em>stamp</em> must be an accurate enough approximation of the current time, and is updated when the function returns. If no datagram has @@ -162,7 +162,7 @@ arrived by absolute date *<em>deadline</em>, the function returns -1 ETIMEOUT. <p> <code> ssize_t socket_sendnb46 (int fd, char const *s, size_t len, ip46_t const *a, uint16_t port, -tain_t const *deadline, tain_t *stamp) </code> <br /> +tain const *deadline, tain *stamp) </code> <br /> Like <tt>socket_send46</tt>, except that the function blocks until a datagram has been effectively sent. *<em>stamp</em> must be an accurate enough approximation of the current time, and is updated when the function returns. If the message still has diff --git a/doc/libstddjb/tai.html b/doc/libstddjb/tai.html @@ -91,8 +91,8 @@ borrow any code from it. <h2> Data structures </h2> <p> - A <tt>tai_t</tt> structure holds an absolute date with a one-second -precision. A <tt>tain_t</tt> structure holds an absolute date with a + A <tt>tai</tt> structure holds an absolute date with a one-second +precision. A <tt>tain</tt> structure holds an absolute date with a maximum of one-nanosecond precision, as permitted by the underlying system call. If <a href="../flags.html#usert">flag-usert</a> is clear, the system clock will be read via @@ -101,12 +101,12 @@ system call, which has a one-microsecond precision; if it is set, the system clock will be read via the <a href="https://www.opengroup.org/onlinepubs/9699919799/functions/clock_gettime.html">clock_gettime()</a> system call, which has a one-nanosecond precision. In either case, a current -<tt>tain_t</tt> will be unable to be more precise than the underlying +<tt>tain</tt> will be unable to be more precise than the underlying implementation. </p> <p> - A <tt>tai_t</tt>, as well as a <tt>tain_t</tt>, can also + A <tt>tai</tt>, as well as a <tt>tain</tt>, can also hold a (possibly negative) relative time, i.e. a difference of absolute dates. It is up to the programmer to make sure that a relative time is never interpreted as an absolute TAI64 date, and vice-versa. @@ -117,7 +117,7 @@ never interpreted as an absolute TAI64 date, and vice-versa. <h3> Wallclock operations </h3> <p> -<code> int tai_now (tai_t *t) </code> <br /> +<code> int tai_now (tai *t) </code> <br /> Writes the current time as a TAI value to *<em>t</em>, with a 1-second precision. The current time is based on the system clock. Make sure skalibs has been compiled with or without the @@ -129,10 +129,10 @@ it fails. </p> <p> -<code> int sysclock_get (tain_t *a) </code> <br /> +<code> int sysclock_get (tain *a) </code> <br /> Reads the current value of the system clock (as in CLOCK_REALTIME) into *<em>a</em>. Returns 1 if it succeeds or 0 (and sets errno) if it fails. -Note that despite being a <tt>tain_t</tt>, *<em>a</em> +Note that despite being a <tt>tain</tt>, *<em>a</em> <strong>does not contain a TAI value</strong> - it only contains an internal, Y2038-safe representation of the value of the system clock, which should be either TAI-10 or UTC. You should not use @@ -140,14 +140,14 @@ this function directly unless you know exactly what you are doing. </p> <p> -<code> int sysclock_set (tain_t const *a) </code> <br /> +<code> int sysclock_set (tain const *a) </code> <br /> Sets the system clock to *<em>a</em>, provided *<em>a</em> has the correct internal representation. You should not use this function directly unless you know exactly what you are doing. </p> <p> -<code> int tain_wallclock_read (tain_t *a) </code> <br /> +<code> int tain_wallclock_read (tain *a) </code> <br /> Reads the current time into *<em>a</em>, as a TAI64N value. Returns 1 if it succeeds or 0 (and sets errno) if it fails. Here <em>a</em> contains a valid TAI64N stamp, no matter what the @@ -156,7 +156,7 @@ on it. </p> <p> -<code> int tain_setnow (tain_t const *a) </code> <br /> +<code> int tain_setnow (tain const *a) </code> <br /> Sets the current time to *<em>a</em>. Returns 1 if it succeeds or 0 (and sets errno) if it fails. <em>a</em> must contain a valid TAI64N stamp; proper @@ -165,7 +165,7 @@ the right format for the system clock. </p> <p> -<code> int tain_now_set_wallclock (tain_t *a) </code> <br /> +<code> int tain_now_set_wallclock (tain *a) </code> <br /> Tells skalibs that future invocations of <tt>tain_now()</tt> (see below) should use a wall clock, i.e. the system time as returned by <tt>clock_gettime(CLOCK_REALTIME)</tt> or @@ -186,7 +186,7 @@ Otherwise, they will fail with errno set to ENOSYS. </p> <p> -<code> int tain_stopwatch_init (tain_t *a, clock_t cl, tain_t *offset) </code> <br /> +<code> int tain_stopwatch_init (tain *a, clock_t cl, tain *offset) </code> <br /> Initializes a stopwatch in *<em>offset</em>, using a clock named <em>cl</em>. Typically, <em>cl</em> is something like CLOCK_MONOTONIC, when it is defined by the system. The actual value of @@ -208,7 +208,7 @@ to zero. </p> <p> -<code> int tain_stopwatch_read (tain_t *a, clock_t cl, tain_t const *offset) </code> <br /> +<code> int tain_stopwatch_read (tain *a, clock_t cl, tain const *offset) </code> <br /> Gives the absolute time, as a TAI64N value, in *<em>a</em>. This absolute time is computed as a linear increase (as measured with the <em>cl</em> clock, which should be a monotonic clock such as @@ -220,7 +220,7 @@ The function returns 1 if it succeeds or 0 (and sets errno) if it fails. </p> <p> -<code> int tain_now_set_stopwatch (tain_t *a) </code> <br /> +<code> int tain_now_set_stopwatch (tain *a) </code> <br /> Tells skalibs that future invocations of <tt>tain_now()</tt> (see below) should use a stopwatch, i.e. the system time as returned by <tt>clock_gettime(CLOCK_MONOTONIC)</tt> or similar, @@ -240,7 +240,7 @@ is returned in *<em>a</em>. <h3> All-purpose time reading </h3> <p> -<code> int tain_now (tain_t *a) </code> <br /> +<code> int tain_now (tain *a) </code> <br /> Writes the current time, as a TAI value, to *<em>a</em>. This is the function you should use by default. It returns 1 if it succeeds or 0 (and sets errno) if it fails. @@ -279,8 +279,8 @@ use the STAMP global variable to store the current timestamp.) format to another; they do not make any assumption about the format of the time contained in those structures. For instance, for the <tt>tai_from_timeval</tt> function, if the struct timeval -contains an absolute UTC time, then the tai_t will also contain -the same UTC time. Despite being a tai_t, it may contain +contains an absolute UTC time, then the tai will also contain +the same UTC time. Despite being a tai, it may contain something else than TAI time. </p> @@ -290,32 +290,32 @@ system clock format to TAI, see the next section. </p> <p> -<code> int tai_from_time (tai_t *t, time_t u) <br /> -int tai_relative_from_time (tai_t *t, time_t u) </code> <br /> +<code> int tai_from_time (tai *t, time_t u) <br /> +int tai_relative_from_time (tai *t, time_t u) </code> <br /> Those functions convert an absolute (resp. relative) time in a time_t to an absolute (resp. relative) -time in a tai_t, with a 1-second precision. They return 1, +time in a tai, with a 1-second precision. They return 1, unless the time_t value is invalid (in which case they return 0). </p> <p> -<code> int time_from_tai (time_t *u, tai_t const *t) <br /> -int time_from_tai_relative (time_t *u, tai_t const *t) </code> <br /> +<code> int time_from_tai (time_t *u, tai const *t) <br /> +int time_from_tai_relative (time_t *u, tai const *t) </code> <br /> The inverse functions of the previous ones. Be aware that time_t is 32 bits on some systems and cannot store all values -of a tai_t (in which case the functions will return 0 EOVERFLOW). +of a tai (in which case the functions will return 0 EOVERFLOW). </p> <p> -<code> int tain_from_timeval (tain_t *a, struct timeval const *tv) <br /> -int tain_relative_from_timeval (tain_t *a, struct timeval const *tv) <br /> -int tain_from_timespec (tain_t *a, struct timespec const *ts) <br /> -int tain_relative_from_timespec (tain_t *a, struct timespec const *ts) <br /> -int timeval_from_tain (struct timeval *tv, tain_t const *a) <br /> -int timeval_from_tain_relative (struct timeval *tv, tain_t const *a) <br /> -int timespec_from_tain (struct timespec *ts, tain_t const *a) <br /> -int timespec_from_tain_relative (struct timespec *ts, tain_t const *a) </code> <br /> -Same conversion operations, between <tt>tain_t</tt> and a +<code> int tain_from_timeval (tain *a, struct timeval const *tv) <br /> +int tain_relative_from_timeval (tain *a, struct timeval const *tv) <br /> +int tain_from_timespec (tain *a, struct timespec const *ts) <br /> +int tain_relative_from_timespec (tain *a, struct timespec const *ts) <br /> +int timeval_from_tain (struct timeval *tv, tain const *a) <br /> +int timeval_from_tain_relative (struct timeval *tv, tain const *a) <br /> +int timespec_from_tain (struct timespec *ts, tain const *a) <br /> +int timespec_from_tain_relative (struct timespec *ts, tain const *a) </code> <br /> +Same conversion operations, between <tt>tain</tt> and a <tt>struct timeval</tt> or <tt>struct timespec</tt>. The 1-microsecond (for <tt>struct timeval</tt>) or 1-nanosecond (for <tt>struct timespec</tt>) precision is preserved. @@ -326,8 +326,8 @@ precision is preserved. <p> Unlike the previous functions, the functions listed here will always operate on valid absolute timestamps. Only TAI64 time is -stored in tai_t structures, and only TAI64N time is stored in -tain_t structures. These functions will convert to/from TAI, +stored in tai structures, and only TAI64N time is stored in +tain structures. These functions will convert to/from TAI, from/to the machine system clock format, i.e. TAI-10 or UTC depending on whether skalibs was compiled with the --enable-tai-clock configure option). @@ -347,31 +347,31 @@ happen on systems with a 32 bit <tt>time_t</tt>), or other error codes. </p> -<code> int tai_from_time_sysclock (tai_t *a, time_t t) <br /> -int time_sysclock_from_tai (time_t *t, tai_t const *a) <br /> -int tain_from_timeval_sysclock (tain_t *a, struct timeval const *tv) <br /> -int timeval_sysclock_from_tain (struct timeval *tv, tain_t const *a) <br /> -int tain_from_timespec_sysclock (tain_t *a, struct timespec const *ts) <br /> -int timespec_sysclock_from_tain (struct timespec *ts, tain_t const *a) </code> +<code> int tai_from_time_sysclock (tai *a, time_t t) <br /> +int time_sysclock_from_tai (time_t *t, tai const *a) <br /> +int tain_from_timeval_sysclock (tain *a, struct timeval const *tv) <br /> +int timeval_sysclock_from_tain (struct timeval *tv, tain const *a) <br /> +int tain_from_timespec_sysclock (tain *a, struct timespec const *ts) <br /> +int timespec_sysclock_from_tain (struct timespec *ts, tain const *a) </code> <h3> Conversions to/from basic types </h3> <p> -<code> int tain_uint (tain_t *a, unsigned int c) </code> <br /> +<code> int tain_uint (tain *a, unsigned int c) </code> <br /> Stores a relative time of <em>c</em> seconds into <em>a</em>. Normally returns 1, but may return 0 EINVAL on pathological numbers. </p> <p> -<code> int tain_from_millisecs (tain_t *a, int ms) </code> <br /> -This function makes a <tt>tain_t</tt> representing a relative +<code> int tain_from_millisecs (tain *a, int ms) </code> <br /> +This function makes a <tt>tain</tt> representing a relative time of <em>ms</em> milliseconds. <em>ms</em> must be non-negative. The function returns 1, unless <em>ms</em> is negative, in which case it returns 0 EINVAL. </p> <p> -<code> int tain_to_millisecs (tain_t const *a) </code> <br /> +<code> int taino_millisecs (tain const *a) </code> <br /> If *<em>a</em> contains a non-negative relative time that fits into a 31-bit integer number of milliseconds, the function returns that number. Else it returns -1 EINVAL. @@ -380,14 +380,14 @@ number. Else it returns -1 EINVAL. <h3> Time computations </h3> <p> -<code> int tai_add (tai_t *t, tai_t const *t1, tai_t const *t2) </code> <br /> +<code> int tai_add (tai *t, tai const *t1, tai const *t2) </code> <br /> Stores *<em>t1</em> + *<em>t2</em> into <em>t</em>. Of course, *<em>t1</em> and *<em>t2</em> must not both represent absolute times. The function normally returns 1, but will return 0 on bad inputs. </p> <p> -<code> int tai_sub (tai_t *t, tai_t const *t1, tai_t const *t2) </code> <br /> +<code> int tai_sub (tai *t, tai const *t1, tai const *t2) </code> <br /> Stores *<em>t1</em> - *<em>t2</em> into <em>t</em>. *<em>t1</em> cannot be relative if *<em>t2</em> is absolute. If they are both relative or both absolute, then *<em>t</em> is relative, else it's absolute. @@ -395,27 +395,27 @@ The function normally returns 1, but will return 0 on bad inputs. </p> <p> -<code> int tain_add (tain_t *a, tain_t const *a1, tain_t const *a2) <br /> -int tain_sub (tain_t *a, tain_t const *a1, tain_t const *a2) </code> <br /> -Same thing with <tt>tain_t</tt>. +<code> int tain_add (tain *a, tain const *a1, tain const *a2) <br /> +int tain_sub (tain *a, tain const *a1, tain const *a2) </code> <br /> +Same thing with <tt>tain</tt>. </p> <p> -<code> int tain_addsec (tain_t *a, tain_t const *a1, int c) </code> <br /> +<code> int tain_addsec (tain *a, tain const *a1, int c) </code> <br /> Adds <em>c</em> seconds to *<em>a1</em> and stores the result into <em>a</em>. <em>c</em> may be negative. </p> <p> -<code> void tain_half (tain_t *a, tain_t const *b) </code> <br /> +<code> void tain_half (tain *a, tain const *b) </code> <br /> Stores *<em>b</em>/2 into <em>a</em>. *<em>b</em> must be relative. </p> <h3> Comparing dates or durations </h3> <p> -<code> int tai_less (tai_t const *t1, tai_t const *t2) <br /> -int tain_less (tain_t const *t1, tain_t const *t2) </code> <br /> +<code> int tai_less (tai const *t1, tai const *t2) <br /> +int tain_less (tain const *t1, tain const *t2) </code> <br /> Those functions return nonzero iff *<em>t1</em> is lesser than *<em>t2</em>. *<em>t1</em> and *<em>t2</em> must be both relative, or both absolute. </p> @@ -423,7 +423,7 @@ Those functions return nonzero iff *<em>t1</em> is lesser than *<em>t2</em>. <h3> Packing and unpacking </h3> <p> -<code> void tai_pack (char *s, tai_t const *t) </code> <br /> +<code> void tai_pack (char *s, tai const *t) </code> <br /> Marshals *<em>t</em> into the buffer <em>s</em> points to, which must be preallocated with at least TAI_PACK (8) characters. Afterwards, the buffer contains the @@ -432,7 +432,7 @@ representation of *<em>t</em>. </p> <p> -<code> void tai_unpack (char const *s, tai_t *t) </code> <br /> +<code> void tai_unpack (char const *s, tai *t) </code> <br /> Unmarshals the <a href="https://cr.yp.to/libtai/tai64.html#tai64">external TAI64 format</a> label pointed to by <em>s</em> (at least TAI_PACK characters) and stores @@ -440,8 +440,8 @@ the result into <em>t</em>. </p> <p> -<code> void tain_pack (char *s, tain_t const *a) <br /> -void tain_unpack (char const *s, tain_t *a) </code> <br /> +<code> void tain_pack (char *s, tain const *a) <br /> +void tain_unpack (char const *s, tain *a) </code> <br /> Same thing with <a href="https://cr.yp.to/libtai/tai64.html#tai64n">external TAI64N format</a>, using TAIN_PACK (12) characters. @@ -450,7 +450,7 @@ using TAIN_PACK (12) characters. <h3> Formatting and scanning </h3> <p> -<code> unsigned int tain_fmt (char *s, tain_t const *a) </code> <br /> +<code> unsigned int tain_fmt (char *s, tain const *a) </code> <br /> Writes into <em>s</em> an ASCII representation of *<em>a</em> in external TAI64N format. <em>s</em> must point to a preallocated buffer of at least TAIN_PACK*2 (24) characters. The function returns the number of bytes that @@ -458,7 +458,7 @@ have been written to <em>s</em> (24). </p> <p> -<code> unsigned int tain_scan (char const *s, tain_t *a) </code> <br /> +<code> unsigned int tain_scan (char const *s, tain *a) </code> <br /> Reads 24 characters from <em>s</em>; if those characters are a valid ASCII representation of the external TAI64N format of some time value, this value is stored into <em>a</em>, and 24 is returned. Else 0 is returned. @@ -473,13 +473,13 @@ format of an absolute date. </p> <p> -<code> unsigned int timestamp_fmt (char *s, tain_t const *a) </code> <br /> +<code> unsigned int timestamp_fmt (char *s, tain const *a) </code> <br /> Writes a TAI64N timestamp representing the absolute date *<em>a</em> into the 25 characters pointed to by <em>s</em>. Returns 25. </p> <p> -<code> unsigned int timestamp_scan (char const *s, tain_t *a) </code> <br /> +<code> unsigned int timestamp_scan (char const *s, tain *a) </code> <br /> Reads 25 characters at <em>s</em>. If those characters are a valid TAI64N timestamp, stores the absolute date in <em>a</em> and returns 25. Else, returns 0.