#include <mach/clock_types.h> also included by
<mach/mach.h>mach/clock_types.h
File: clock_types.h
Purpose: Clock facility header definitions. These
definitons are needed by both kernel and
user-level software.
typedefalarm_type_t
Type definitions.
typedef int alarm_type_t
alarm time type
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Defined values:
| TIME_RELATIVE | Interpret the alarm time as relative to the current time. |
| TIME_ABSOLUTE | Interpret the alarm time as an absolute time. |
typedefsleep_type_t
typedef int sleep_type_t
sleep time type
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Defined values:
| TIME_RELATIVE | Interpret the sleep time as relative to the current time. |
| TIME_ABSOLUTE | Interpret the sleep time as an absolute time. |
typedefclock_id_t
typedef int clock_id_t
clock identification type
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Defined values:
| REALTIME_CLOCK | A moderate resolution clock service that (typically) tracks time since the system last boot. |
| BATTERY_CLOCK | A (typically) low resolution clock (to the second) that survives power failures or service outages. |
| HIGHRES_CLOCK | A high resolution clock. |
typedefclock_flavor_t
typedef int clock_flavor_t
clock flavor type
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Defined values:
| CLOCK_GET_TIME_RES | The resolution, in nanoseconds, with which the value returned by clock_get_time is updated. |
| CLOCK_MAP_TIME_RES | The resolution, in nanoseconds, with which the value visible via clock_map_time is updated. |
| CLOCK_ALARM_CURRES | The resolution, in nanoseconds, at which clock alarm and sleep timers are currently serviced. |
| CLOCK_ALARM_MINRES | The minimum resolution, in nanoseconds, at which clock alarm and sleep timers can be serviced. |
| CLOCK_ALARM_MAXRES | The maximum resolution, in nanoseconds, at which clock alarm and sleep timers can be serviced. |
structmach_timespec
Normal time specification used by the kernel clock facility.
| unsigned int | tv_sec | seconds |
| clock_res_t | tv_nsec | nanoseconds |
typedefmach_timespec_t
typedef struct mach_timespec mach_timespec_t
macroCALENDAR_CLOCK
#define CALENDAR_CLOCK 1
macroREALTIME_CLOCK
#define REALTIME_CLOCK 0
CMU/MIT Mach reference · manual page · © Carnegie Mellon
A moderate resolution clock service that (typically) tracks time since the system last boot.
macroCLOCK_GET_TIME_RES
Attribute names.
#define CLOCK_GET_TIME_RES 1
get_time call resolution
CMU/MIT Mach reference · manual page · © Carnegie Mellon
The resolution, in nanoseconds, with which the value returned by clock_get_time is updated.
macroCLOCK_ALARM_CURRES
2 * was map_time call resolution
#define CLOCK_ALARM_CURRES 3
current alarm resolution
CMU/MIT Mach reference · manual page · © Carnegie Mellon
The resolution, in nanoseconds, at which clock alarm and sleep timers are currently serviced.
macroCLOCK_ALARM_MINRES
#define CLOCK_ALARM_MINRES 4
minimum alarm resolution
CMU/MIT Mach reference · manual page · © Carnegie Mellon
The minimum resolution, in nanoseconds, at which clock alarm and sleep timers can be serviced.
macroCLOCK_ALARM_MAXRES
#define CLOCK_ALARM_MAXRES 5
maximum alarm resolution
CMU/MIT Mach reference · manual page · © Carnegie Mellon
The maximum resolution, in nanoseconds, at which clock alarm and sleep timers can be serviced.
macroBAD_MACH_TIMESPEC
#define BAD_MACH_TIMESPEC(t) ((t)->tv_nsec < 0 || (t)->tv_nsec >= (long)NSEC_PER_SEC)
macroCMP_MACH_TIMESPEC
t1 <=> t2, also (t1 - t2) in nsec with max of +- 1 sec
#define CMP_MACH_TIMESPEC(t1, t2) ((t1)->tv_sec > (t2)->tv_sec ? (long) +NSEC_PER_SEC : ((t1)->tv_sec < (t2)->tv_sec ? (long) -NSEC_PER_SEC : (t1)->tv_nsec - (t2)->tv_nsec))
macroADD_MACH_TIMESPEC
t1 += t2
#define ADD_MACH_TIMESPEC(t1, t2) do {
if (((t1)->tv_nsec += (t2)->tv_nsec) >= (long) NSEC_PER_SEC) {
(t1)->tv_nsec -= (long) NSEC_PER_SEC;
(t1)->tv_sec += 1;
}
(t1)->tv_sec += (t2)->tv_sec;
} while (0)macroSUB_MACH_TIMESPEC
t1 -= t2
#define SUB_MACH_TIMESPEC(t1, t2) do {
if (((t1)->tv_nsec -= (t2)->tv_nsec) < 0) {
(t1)->tv_nsec += (long) NSEC_PER_SEC;
(t1)->tv_sec -= 1;
}
(t1)->tv_sec -= (t2)->tv_sec;
} while (0)macroTIME_ABSOLUTE
#define TIME_ABSOLUTE 0x00
absolute time
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Interpret the alarm time as an absolute time.
macroTIME_RELATIVE
#define TIME_RELATIVE 0x01
relative time
CMU/MIT Mach reference · manual page · © Carnegie Mellon
Interpret the alarm time as relative to the current time.
macroBAD_ALRMTYPE
#define BAD_ALRMTYPE(t) (((t) &~ TIME_RELATIVE) != 0)