#include <sys/time.h>
sys/time.h
structitimerval
Structure used as a parameter by getitimer(2) and setitimer(2) system
calls.
| struct timeval | it_interval | timer interval |
| struct timeval | it_value | current value |
macroITIMER_REAL
Names of the interval timers, and structure
defining a timer setting.
#define ITIMER_REAL 0
macroITIMER_VIRTUAL
#define ITIMER_VIRTUAL 1
macroITIMER_PROF
#define ITIMER_PROF 2
macroTIMEVAL_TO_TIMESPEC
#define TIMEVAL_TO_TIMESPEC(tv, ts) {
(ts)->tv_sec = (tv)->tv_sec;
(ts)->tv_nsec = (tv)->tv_usec * 1000;
}macroTIMESPEC_TO_TIMEVAL
#define TIMESPEC_TO_TIMEVAL(tv, ts) {
(tv)->tv_sec = (ts)->tv_sec;
(tv)->tv_usec = (__darwin_suseconds_t)((ts)->tv_nsec / 1000);
}structtimezone
| int | tz_minuteswest | minutes west of Greenwich |
| int | tz_dsttime | type of dst correction |
macrotimerisset
#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
macrotimercmp
#define timercmp(tvp, uvp, cmp) (((tvp)->tv_sec == (uvp)->tv_sec) ? ((tvp)->tv_usec cmp (uvp)->tv_usec) : ((tvp)->tv_sec cmp (uvp)->tv_sec))
macrotimeradd
#define timeradd(tvp, uvp, vvp) do {
(vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec;
(vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec;
if ((vvp)->tv_usec >= 1000000) {
(vvp)->tv_sec++;
(vvp)->tv_usec -= 1000000;
}
} while (0)macrotimersub
#define timersub(tvp, uvp, vvp) do {
(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec;
(vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec;
if ((vvp)->tv_usec < 0) {
(vvp)->tv_sec--;
(vvp)->tv_usec += 1000000;
}
} while (0)structclockinfo
Getkerninfo clock information structure
| int | hz | clock frequency |
| int | tick | micro-seconds per hz tick |
| int | tickadj | clock skew rate for adjtime() |
| int | stathz | statistics clock frequency |
| int | profhz | profiling clock frequency |
functionadjtime
int adjtime(const struct timeval *, struct timeval *)
man page · June 4, 1993
adjtime(2) — "correct the time to allow synchronization of the system clock"functionfutimes
int futimes(int, const struct timeval *)
man page · June 4, 1993
futimes(2) — set file access and modification timesfunctionlutimes
__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) int lutimes(const char *, const struct timeval *)
man page · Aug 13, 2006
lutimes(3) — set file access and modification times of symlinkfunctionsettimeofday
int settimeofday(const struct timeval *, const struct timezone *)
man page · August 5, 2008
settimeofday(2) — get/set date and timefunctiongetitimer
int getitimer(int, struct itimerval *)
man page · December 11, 1993
getitimer(2) — get/set value of interval timerfunctiongettimeofday
int gettimeofday(struct timeval * __restrict, void * __restrict)
man page · August 5, 2008
gettimeofday(2) — get/set date and timefunctionsetitimer
int setitimer(int, const struct itimerval * __restrict, struct itimerval * __restrict)
man page · December 11, 1993
setitimer(2) — get/set value of interval timer