Annotation of XNU/osfmk/mach/time_value.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
        !             3:  *
        !             4:  * @APPLE_LICENSE_HEADER_START@
        !             5:  * 
        !             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.
        !            11:  * 
        !            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
        !            18:  * under the License.
        !            19:  * 
        !            20:  * @APPLE_LICENSE_HEADER_END@
        !            21:  */
        !            22: /*
        !            23:  * @OSF_COPYRIGHT@
        !            24:  */
        !            25: /*
        !            26:  * HISTORY
        !            27:  * 
        !            28:  * Revision 1.1.1.1  1998/09/22 21:05:31  wsanchez
        !            29:  * Import of Mac OS X kernel (~semeria)
        !            30:  *
        !            31:  * Revision 1.1.1.1  1998/03/07 02:25:46  wsanchez
        !            32:  * Import of OSF Mach kernel (~mburg)
        !            33:  *
        !            34:  * Revision 1.2.11.2  1995/01/06  19:52:17  devrcs
        !            35:  *     mk6 CR668 - 1.3b26 merge
        !            36:  *     64bit cleanup
        !            37:  *     [1994/10/14  03:43:25  dwm]
        !            38:  *
        !            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]
        !            42:  * 
        !            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]
        !            46:  * 
        !            47:  * Revision 1.2  1993/04/19  16:40:14  devrcs
        !            48:  *     ansi C conformance changes
        !            49:  *     [1993/02/02  18:55:30  david]
        !            50:  * 
        !            51:  * Revision 1.1  1992/09/30  02:32:21  robert
        !            52:  *     Initial revision
        !            53:  * 
        !            54:  * $EndLog$
        !            55:  */
        !            56: /* CMU_HIST */
        !            57: /*
        !            58:  * Revision 2.4  91/05/18  14:35:13  rpd
        !            59:  *     Added mapped_time_value_t.
        !            60:  *     [91/03/21            rpd]
        !            61:  * 
        !            62:  * Revision 2.3  91/05/14  17:01:40  mrt
        !            63:  *     Correcting copyright
        !            64:  * 
        !            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]
        !            68:  * 
        !            69:  * Revision 2.1  89/08/03  16:06:24  rwd
        !            70:  * Created.
        !            71:  * 
        !            72:  * Revision 2.4  89/02/25  18:41:34  gm0w
        !            73:  *     Changes for cleanup.
        !            74:  * 
        !            75:  * Revision 2.3  89/02/07  00:53:58  mwyoung
        !            76:  * Relocated from sys/time_value.h
        !            77:  * 
        !            78:  * Revision 2.2  89/01/31  01:21:58  rpd
        !            79:  *     TIME_MICROS_MAX should be 1 Million, not 10 Million.
        !            80:  *     [88/10/12            dlb]
        !            81:  * 
        !            82:  *  4-Jan-88  David Golub (dbg) at Carnegie-Mellon University
        !            83:  *     Created.
        !            84:  *
        !            85:  */
        !            86: /* CMU_ENDHIST */
        !            87: /* 
        !            88:  * Mach Operating System
        !            89:  * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
        !            90:  * All Rights Reserved.
        !            91:  * 
        !            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.
        !            97:  * 
        !            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.
        !           101:  * 
        !           102:  * Carnegie Mellon requests users of this software to return to
        !           103:  * 
        !           104:  *  Software Distribution Coordinator  or  [email protected]
        !           105:  *  School of Computer Science
        !           106:  *  Carnegie Mellon University
        !           107:  *  Pittsburgh PA 15213-3890
        !           108:  * 
        !           109:  * any improvements or extensions that they make and grant Carnegie Mellon
        !           110:  * the rights to redistribute these changes.
        !           111:  */
        !           112: /*
        !           113:  */
        !           114: 
        !           115: #ifndef        TIME_VALUE_H_
        !           116: #define        TIME_VALUE_H_
        !           117: 
        !           118: #include <mach/machine/vm_types.h>
        !           119: 
        !           120: /*
        !           121:  *     Time value returned by kernel.
        !           122:  */
        !           123: 
        !           124: struct time_value {
        !           125:        integer_t seconds;
        !           126:        integer_t microseconds;
        !           127: };
        !           128: typedef        struct time_value       time_value_t;
        !           129: 
        !           130: /*
        !           131:  *     Macros to manipulate time values.  Assume that time values
        !           132:  *     are normalized (microseconds <= 999999).
        !           133:  */
        !           134: #define        TIME_MICROS_MAX (1000000)
        !           135: 
        !           136: #define        time_value_add_usec(val, micros)        {       \
        !           137:        if (((val)->microseconds += (micros))           \
        !           138:                >= TIME_MICROS_MAX) {                   \
        !           139:            (val)->microseconds -= TIME_MICROS_MAX;     \
        !           140:            (val)->seconds++;                           \
        !           141:        }                                               \
        !           142: }
        !           143: 
        !           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++;                                \
        !           150:        }                                                       \
        !           151: }
        !           152: 
        !           153: /*
        !           154:  *     Time value available through the mapped-time interface.
        !           155:  *     Read this mapped value with
        !           156:  *             do {
        !           157:  *                     secs = mtime->seconds;
        !           158:  *                     usecs = mtime->microseconds;
        !           159:  *             } while (secs != mtime->check_seconds);
        !           160:  */
        !           161: 
        !           162: typedef struct mapped_time_value {
        !           163:        integer_t seconds;
        !           164:        integer_t microseconds;
        !           165:        integer_t check_seconds;
        !           166: } mapped_time_value_t;
        !           167: 
        !           168: #endif /* TIME_VALUE_H_ */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.