|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights ! 7: * Reserved. This file contains Original Code and/or Modifications of ! 8: * Original Code as defined in and that are subject to the Apple Public ! 9: * Source License Version 1.1 (the "License"). You may not use this file ! 10: * except in compliance with the License. Please obtain a copy of the ! 11: * License at http://www.apple.com/publicsource and read it before using ! 12: * this file. ! 13: * ! 14: * The Original Code and all software distributed under the License are ! 15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 19: * License for the specific language governing rights and limitations ! 20: * under the License. ! 21: * ! 22: * @APPLE_LICENSE_HEADER_END@ ! 23: */ ! 24: ! 25: /* ! 26: * Mach Operating System ! 27: * Copyright (c) 1987 Carnegie-Mellon University ! 28: * All rights reserved. The CMU software License Agreement specifies ! 29: * the terms and conditions for use and redistribution. ! 30: */ ! 31: /* ! 32: * HISTORY ! 33: * 15-Feb-88 Gregg Kellogg (gk) at NeXT ! 34: * NeXT: use microsecond counter like multimax ! 35: * ! 36: * 16-Jun-87 David Black (dlb) at Carnegie-Mellon University ! 37: * machtimer.h --> timer.h Changed to cpp symbols for multimax. ! 38: * ! 39: * 5-Apr-87 Avadis Tevanian (avie) at Carnegie-Mellon University ! 40: * ts.h -> time_stamp.h ! 41: * ! 42: * 30-Mar-87 David Black (dlb) at Carnegie-Mellon University ! 43: * Created. ! 44: */ ! 45: #import <mach/kern_return.h> ! 46: #import <kern/time_stamp.h> ! 47: #import <kern/clock.h> ! 48: ! 49: #if m68k ! 50: #import <machdep/m68k/eventc.h> ! 51: #endif m68k ! 52: ! 53: /* ! 54: * ts.c - kern_timestamp system call. ! 55: */ ! 56: ! 57: kern_return_t kern_timestamp(tsp) ! 58: struct tsval *tsp; ! 59: { ! 60: struct tsval ts; ! 61: ! 62: #if m68k ! 63: event_set_ts(&ts); ! 64: #else m68k ! 65: unsigned long long usec_now; ! 66: tvalspec_t now; ! 67: ! 68: now = clock_get_counter(System); ! 69: usec_now = ((unsigned long long)now.tv_sec * USEC_PER_SEC) + ! 70: (now.tv_nsec / NSEC_PER_USEC); ! 71: ts.low_val = (unsigned int)usec_now; ! 72: ts.high_val = usec_now >> 32; ! 73: #endif m68k ! 74: ! 75: if (copyout(&ts, tsp, sizeof(struct tsval)) != KERN_SUCCESS) ! 76: return(KERN_INVALID_ADDRESS); ! 77: ! 78: return(KERN_SUCCESS); ! 79: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.