]> git.saurik.com Git - apple/xnu.git/blob - osfmk/sys/time.h
f44082afe00591d0ff88a86d93e7ff2f1db8d51a
[apple/xnu.git] / osfmk / sys / time.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
29 */
30 /*
31 * @OSF_COPYRIGHT@
32 */
33 /*
34 * HISTORY
35 *
36 * Revision 1.1.1.1 1998/09/22 21:05:48 wsanchez
37 * Import of Mac OS X kernel (~semeria)
38 *
39 * Revision 1.1.1.1 1998/03/07 02:25:59 wsanchez
40 * Import of OSF Mach kernel (~mburg)
41 *
42 * Revision 1.2.6.1 1994/09/23 03:13:17 ezf
43 * change marker to not FREE
44 * [1994/09/22 21:58:56 ezf]
45 *
46 * Revision 1.2.2.2 1993/06/09 02:55:33 gm
47 * Added to OSF/1 R1.3 from NMK15.0.
48 * [1993/06/02 21:31:02 jeffc]
49 *
50 * Revision 1.2 1993/04/19 17:17:07 devrcs
51 * Fixes for ANSI C
52 * [1993/02/26 14:02:46 sp]
53 *
54 * Revision 1.1 1992/09/30 02:36:58 robert
55 * Initial revision
56 *
57 * $EndLog$
58 */
59 /* CMU_HIST */
60 /*
61 * Revision 2.3 91/05/14 17:40:25 mrt
62 * Correcting copyright
63 *
64 * Revision 2.2 91/02/05 17:56:58 mrt
65 * Changed to new Mach copyright
66 * [91/02/01 17:49:29 mrt]
67 *
68 */
69 /* CMU_ENDHIST */
70 /*
71 * Mach Operating System
72 * Copyright (c) 1991 Carnegie Mellon University
73 * All Rights Reserved.
74 *
75 * Permission to use, copy, modify and distribute this software and its
76 * documentation is hereby granted, provided that both the copyright
77 * notice and this permission notice appear in all copies of the
78 * software, derivative works or modified versions, and any portions
79 * thereof, and that both notices appear in supporting documentation.
80 *
81 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
82 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
83 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
84 *
85 * Carnegie Mellon requests users of this software to return to
86 *
87 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
88 * School of Computer Science
89 * Carnegie Mellon University
90 * Pittsburgh PA 15213-3890
91 *
92 * any improvements or extensions that they make and grant Carnegie Mellon rights
93 * to redistribute these changes.
94 */
95 /*
96 */
97 /*
98 * Time-keeper for kernel IO devices.
99 *
100 * May or may not have any relation to wall-clock time.
101 */
102
103 #ifndef _SYS_TIME_H_
104 #define _SYS_TIME_H_
105 #include <mach/time_value.h>
106
107 extern time_value_t time;
108
109 /*
110 * Definitions to keep old code happy.
111 */
112 #define timeval_t time_value_t
113 #define timeval time_value
114 #define tv_sec seconds
115 #define tv_usec microseconds
116
117 #define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
118 #define timercmp(tvp, uvp, cmp) \
119 ((tvp)->tv_sec cmp (uvp)->tv_sec || \
120 (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
121 #define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
122 #endif /* _SYS_TIME_H_ */