8446 uts: pci_check_bios() should check for BIOS
[unleashed.git] / include / sys / time_impl.h
blob4fb2551c7316b4193b077429082129d5da5f84ed
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
28 * Implementation-private. This header should not be included
29 * directly by an application. The application should instead
30 * include <time.h> which includes this header conditionally
31 * depending on which feature test macros are defined. By default,
32 * this header is included by <time.h>. X/Open and POSIX
33 * standards requirements result in this header being included
34 * by <time.h> only under a restricted set of conditions.
37 #ifndef _SYS_TIME_IMPL_H
38 #define _SYS_TIME_IMPL_H
40 #include <sys/feature_tests.h>
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
46 #ifndef _ASM
48 #if !defined(_TIME_T) || __cplusplus >= 199711L
49 #define _TIME_T
50 typedef long time_t; /* time of day in seconds */
51 #endif /* _TIME_T */
54 * Time expressed in seconds and nanoseconds
57 typedef struct timespec { /* definition per POSIX.4 */
58 time_t tv_sec; /* seconds */
59 long tv_nsec; /* and nanoseconds */
60 } timespec_t;
62 #if defined(_SYSCALL32)
64 #include <sys/types32.h>
66 #define TIMESPEC32_TO_TIMESPEC(ts, ts32) { \
67 (ts)->tv_sec = (time_t)(ts32)->tv_sec; \
68 (ts)->tv_nsec = (ts32)->tv_nsec; \
71 #define TIMESPEC_TO_TIMESPEC32(ts32, ts) { \
72 (ts32)->tv_sec = (time32_t)(ts)->tv_sec; \
73 (ts32)->tv_nsec = (ts)->tv_nsec; \
76 #define TIMESPEC_OVERFLOW(ts) \
77 ((ts)->tv_sec < TIME32_MIN || (ts)->tv_sec > TIME32_MAX)
79 #endif /* _SYSCALL32 */
81 typedef struct timespec timestruc_t; /* definition per SVr4 */
84 * The following has been left in for backward compatibility. Portable
85 * applications should not use the structure name timestruc.
88 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
89 #define timestruc timespec /* structure name per SVr4 */
90 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
93 * Timer specification
95 typedef struct itimerspec { /* definition per POSIX.4 */
96 struct timespec it_interval; /* timer period */
97 struct timespec it_value; /* timer expiration */
98 } itimerspec_t;
100 #if defined(_SYSCALL32)
102 #define ITIMERSPEC32_TO_ITIMERSPEC(it, it32) { \
103 TIMESPEC32_TO_TIMESPEC(&(it)->it_interval, &(it32)->it_interval); \
104 TIMESPEC32_TO_TIMESPEC(&(it)->it_value, &(it32)->it_value); \
107 #define ITIMERSPEC_TO_ITIMERSPEC32(it32, it) { \
108 TIMESPEC_TO_TIMESPEC32(&(it32)->it_interval, &(it)->it_interval); \
109 TIMESPEC_TO_TIMESPEC32(&(it32)->it_value, &(it)->it_value); \
112 #define ITIMERSPEC_OVERFLOW(it) \
113 (TIMESPEC_OVERFLOW(&(it)->it_interval) && \
114 TIMESPEC_OVERFLOW(&(it)->it_value))
116 #endif /* _SYSCALL32 */
118 #endif /* _ASM */
120 #define __CLOCK_REALTIME0 0 /* obsolete; same as CLOCK_REALTIME */
121 #define CLOCK_VIRTUAL 1 /* thread's user-level CPU clock */
122 #define CLOCK_THREAD_CPUTIME_ID 2 /* thread's user+system CPU clock */
123 #define CLOCK_REALTIME 3 /* wall clock */
124 #define CLOCK_MONOTONIC 4 /* high resolution monotonic clock */
125 #define CLOCK_PROCESS_CPUTIME_ID 5 /* process's user+system CPU clock */
126 #define CLOCK_HIGHRES CLOCK_MONOTONIC /* alternate name */
127 #define CLOCK_PROF CLOCK_THREAD_CPUTIME_ID /* alternate name */
129 #ifdef _KERNEL
130 #define CLOCK_MAX 6
131 #endif
133 #define TIMER_RELTIME 0x0 /* set timer relative */
134 #define TIMER_ABSTIME 0x1 /* set timer absolute */
136 #ifdef __cplusplus
138 #endif
140 #endif /* _SYS_TIME_IMPL_H */