]> git.saurik.com Git - apple/libc.git/blame - i386/mach/mach_absolute_time.c
Libc-262.tar.gz
[apple/libc.git] / i386 / mach / mach_absolute_time.c
CommitLineData
e9ce8d39 1/*
5b2abdfb 2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
e9ce8d39
A
3 *
4 * @APPLE_LICENSE_HEADER_START@
5b2abdfb 5 *
e9ce8d39
A
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.
5b2abdfb 11 *
e9ce8d39
A
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.
e9ce8d39 19 *
5b2abdfb 20 * @APPLE_LICENSE_HEADER_END@
e9ce8d39 21 */
5b2abdfb
A
22#if !defined(__ppc__)
23#include <stdint.h>
24#include <mach/clock.h>
e9ce8d39 25
5b2abdfb 26extern mach_port_t clock_port;
e9ce8d39 27
5b2abdfb
A
28uint64_t mach_absolute_time(void) {
29 mach_timespec_t now;
30 (void)clock_get_time(clock_port, &now);
31 return (uint64_t)now.tv_sec * NSEC_PER_SEC + now.tv_nsec;
e9ce8d39 32}
5b2abdfb 33#endif