NAME
tv - high resolution time support
SYNOPSIS
$1$2#include <tv.h>#include <tv.h>#include <tv.h>#include <tv.h>#include <tv.h>#include <tv.h>#include <tv.h>#include <tv.h>
DESCRIPTION
The tv library supports high resolution Tv_t time specifications.
Tv_t
contains these elements:
- $1$2unsignedunsignedunsignedunsignedunsignedunsignedunsignedunsigned
-
$1$2_ast_int4_t_ast_int4_t_ast_int4_t_ast_int4_t_ast_int4_t_ast_int4_t_ast_int4_t_ast_int4_t $1$2tv_sectv_sectv_sectv_sectv_sectv_sectv_sectv_sec Seconds since the epoch.
- $1$2unsignedunsignedunsignedunsignedunsignedunsignedunsignedunsigned
-
$1$2_ast_int4_t_ast_int4_t_ast_int4_t_ast_int4_t_ast_int4_t_ast_int4_t_ast_int4_t_ast_int4_t $1$2tv_nsectv_nsectv_nsectv_nsectv_nsectv_nsectv_nsectv_nsec Nanosecond resolution.
In practice resolution is much coarser than 1 nanosecond. Systems that only support 1 second resolution always set $1$2tv_nsectv_nsectv_nsectv_nsectv_nsectv_nsectv_nsectv_nsec to 0.
int tvgettime(Tv_t* tv)
Sets $1$2tvtvtvtvtvtvtvtv to the current time. $1$200000000 is returned on success, $1$2-1-1-1-1-1-1-1-1 on error.
int tvsettime(const Tv_t* tv)
Sets the system time to $1$2tvtvtvtvtvtvtvtv The caller must have sufficient privilege. $1$200000000 is returned on success, $1$2-1-1-1-1-1-1-1-1 on error.
int tvcmp(const Tv_t* av, const Tv_t* bv)
Compares the times $1$2avavavavavavavav and $1$2bvbvbvbvbvbvbvbv and returns $1$2-1-1-1-1-1-1-1-1 if $1$2avavavavavavavav is less than $1$2bvbvbvbvbvbvbvbv $1$200000000 if $1$2avavavavavavavav is equal to $1$2bvbvbvbvbvbvbvbv and $1$211111111 if $1$2avavavavavavavav is greater than $1$2bvbvbvbvbvbvbvbv
time_t tvgetatime(Tv_t* tv, const struct stat* st)
time_t tvgetmtime(Tv_t* tv, const struct stat* st)
time_t tvgetctime(Tv_t* tv, const struct stat* st)
These macros set $1$2tvtvtvtvtvtvtvtv to the $1$2stststststststst the access, modify, or change time, respectively. The seconds portion of $1$2tvtvtvtvtvtvtvtv is returned.
time_t tvsetatime(Tv_t* tv, struct stat* st)
time_t tvsetmtime(Tv_t* tv, struct stat* st)
time_t tvsetctime(Tv_t* tv, struct stat* st)
These macros set the $1$2stststststststst access, modify, or change time, respectively, to $1$2tvtvtvtvtvtvtvtv The seconds portion of $1$2tvtvtvtvtvtvtvtv is returned.
int tvtouch(const char* path, const Tv_t* av, const Tv_t* mv, const Tv_t* cv, int copy)
Sets the file $1$2pathpathpathpathpathpathpathpath access time from $1$2avavavavavavavav modify time from $1$2mvmvmvmvmvmvmvmv and change time from $1$2cvcvcvcvcvcvcvcv Any of $1$2avavavavavavavav $1$2mvmvmvmvmvmvmvmv and $1$2cvcvcvcvcvcvcvcv may be 0; the corresponding file time will retain the previous value if $1$2pathpathpathpathpathpathpathpath exists and $1$2copycopycopycopycopycopycopycopy is $1$211111111 otherwise the corresponding file time will be set to the current time. $1$200000000 is returned on success, $1$2-1-1-1-1-1-1-1-1 on error.
int tvsleep(const Tv_t* tv, Tv_t* rv)
Pauses execution for $1$2tvtvtvtvtvtvtvtv time. $1$200000000 is returned if the full $1$2tvtvtvtvtvtvtvtv amount has expired. Otherwise $1$2-1-1-1-1-1-1-1-1 is returned and $1$2rvrvrvrvrvrvrvrv if not 0, is set to the sleep time remaining.
RETURN VALUE
Except for $1$2tvcmp()tvcmp()tvcmp()tvcmp()tvcmp()tvcmp()tvcmp()tvcmp() an error return of $1$2-1-1-1-1-1-1-1-1 also sets $1$2errnoerrnoerrnoerrnoerrnoerrnoerrnoerrno to the corresponding error code.