xref: /titanic_51/usr/src/lib/libast/common/man/tv.3 (revision 7014882c6a3672fd0e5d60200af8643ae53c5928)
.fp 5 CW .. .nr ;G \\n(.f .Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9" \\*(;G .. .aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" .. .aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" .. .aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" ..

0

..

..

TM 3
NAME
tv - high resolution time support
SYNOPSIS
.L "#include <tv.h>"
DESCRIPTION
The tv library supports high resolution Tv_t time specifications.
Tv_t
contains these elements:

.L unsigned .L _ast_int4_t .L tv_sec Seconds since the epoch.

.L unsigned .L _ast_int4_t .L tv_nsec Nanosecond resolution.

In practice resolution is much coarser than 1 nanosecond. Systems that only support 1 second resolution always set .L tv_nsec to 0.

"int tvgettime(Tv_t* tv)"
Sets .L tv to the current time. .L 0 is returned on success, .L -1 on error.
"int tvsettime(const Tv_t* tv)"
Sets the system time to .LR tv . The caller must have sufficient privilege. .L 0 is returned on success, .L -1 on error.
"int tvcmp(const Tv_t* av, const Tv_t* bv)"
Compares the times .L av and .L bv and returns .L -1 if .L av is less than .LR bv , .L 0 if .L av is equal to .LR bv , and .L 1 if .L av is greater than .LR bv .
"time_t tvgetatime(const struct stat* st, Tv_t* tv)"
"time_t tvgetmtime(const struct stat* st, Tv_t* tv)"
"time_t tvgetctime(const struct stat* st, Tv_t* tv)"
These macros set .L tv to the .L st the access, modify, or change time, respectively. The seconds portion of .L tv is returned.
"time_t tvsetatime(struct stat* st, const Tv_t* tv)"
"time_t tvsetmtime(struct stat* st, const Tv_t* tv)"
"time_t tvsetctime(struct stat* st, const Tv_t* tv)"
These macros set the .L st access, modify, or change time, respectively, to .LR tv . The seconds portion of .L tv is returned.
"int tvtouch(const char* path, const Tv_t* av, const Tv_t* mv, const Tv_t* cv, int copy)"
Sets the file .L path access time from .LR av , modify time from .LR mv , and change time from .LR cv . Any of .LR av , .LR mv , and .L cv may be 0; the corresponding file time will retain the previous value if .L path exists and .L copy is .L 1 ; otherwise the corresponding file time will be set to the current time. .L 0 is returned on success, .L -1 on error.
"int tvsleep(const Tv_t* tv, Tv_t* rv)"
Pauses execution for .L tv time. .L 0 is returned if the full .L tv amount has expired. Otherwise .L -1 is returned and .LR rv , if not 0, is set to the sleep time remaining.
"RETURN VALUE"
Except for .LR tvcmp() , an error return of .L -1 also sets .L errno to the corresponding error code.
"SEE ALSO"
tm(3)