]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/time_value.h
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
28 * Revision 1.1.1.1 1998/09/22 21:05:31 wsanchez
29 * Import of Mac OS X kernel (~semeria)
31 * Revision 1.1.1.1 1998/03/07 02:25:46 wsanchez
32 * Import of OSF Mach kernel (~mburg)
34 * Revision 1.2.11.2 1995/01/06 19:52:17 devrcs
35 * mk6 CR668 - 1.3b26 merge
37 * [1994/10/14 03:43:25 dwm]
39 * Revision 1.2.11.1 1994/09/23 02:43:49 ezf
40 * change marker to not FREE
41 * [1994/09/22 21:43:27 ezf]
43 * Revision 1.2.3.2 1993/06/09 02:44:03 gm
44 * Added to OSF/1 R1.3 from NMK15.0.
45 * [1993/06/02 21:18:38 jeffc]
47 * Revision 1.2 1993/04/19 16:40:14 devrcs
48 * ansi C conformance changes
49 * [1993/02/02 18:55:30 david]
51 * Revision 1.1 1992/09/30 02:32:21 robert
58 * Revision 2.4 91/05/18 14:35:13 rpd
59 * Added mapped_time_value_t.
62 * Revision 2.3 91/05/14 17:01:40 mrt
63 * Correcting copyright
65 * Revision 2.2 91/02/05 17:36:49 mrt
66 * Changed to new Mach copyright
67 * [91/02/01 17:22:07 mrt]
69 * Revision 2.1 89/08/03 16:06:24 rwd
72 * Revision 2.4 89/02/25 18:41:34 gm0w
73 * Changes for cleanup.
75 * Revision 2.3 89/02/07 00:53:58 mwyoung
76 * Relocated from sys/time_value.h
78 * Revision 2.2 89/01/31 01:21:58 rpd
79 * TIME_MICROS_MAX should be 1 Million, not 10 Million.
82 * 4-Jan-88 David Golub (dbg) at Carnegie-Mellon University
88 * Mach Operating System
89 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
90 * All Rights Reserved.
92 * Permission to use, copy, modify and distribute this software and its
93 * documentation is hereby granted, provided that both the copyright
94 * notice and this permission notice appear in all copies of the
95 * software, derivative works or modified versions, and any portions
96 * thereof, and that both notices appear in supporting documentation.
98 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
99 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
100 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
102 * Carnegie Mellon requests users of this software to return to
104 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
105 * School of Computer Science
106 * Carnegie Mellon University
107 * Pittsburgh PA 15213-3890
109 * any improvements or extensions that they make and grant Carnegie Mellon
110 * the rights to redistribute these changes.
115 #ifndef TIME_VALUE_H_
116 #define TIME_VALUE_H_
118 #include <mach/machine/vm_types.h>
121 * Time value returned by kernel.
126 integer_t microseconds
;
128 typedef struct time_value time_value_t
;
131 * Macros to manipulate time values. Assume that time values
132 * are normalized (microseconds <= 999999).
134 #define TIME_MICROS_MAX (1000000)
136 #define time_value_add_usec(val, micros) { \
137 if (((val)->microseconds += (micros)) \
138 >= TIME_MICROS_MAX) { \
139 (val)->microseconds -= TIME_MICROS_MAX; \
144 #define time_value_add(result, addend) { \
145 (result)->microseconds += (addend)->microseconds; \
146 (result)->seconds += (addend)->seconds; \
147 if ((result)->microseconds >= TIME_MICROS_MAX) { \
148 (result)->microseconds -= TIME_MICROS_MAX; \
149 (result)->seconds++; \
154 * Time value available through the mapped-time interface.
155 * Read this mapped value with
157 * secs = mtime->seconds;
158 * usecs = mtime->microseconds;
159 * } while (secs != mtime->check_seconds);
162 typedef struct mapped_time_value
{
164 integer_t microseconds
;
165 integer_t check_seconds
;
166 } mapped_time_value_t
;
168 #endif /* TIME_VALUE_H_ */