VirtualBox

source: vbox/trunk/src/VBox/Runtime/r0drv/solaris/time-r0drv-solaris.c@ 4179

Last change on this file since 4179 was 4179, checked in by vboxsync, 17 years ago

Solaris changes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
1/* $Id: time-r0drv-solaris.c 4179 2007-08-16 15:08:07Z vboxsync $ */
2/** @file
3 * innotek Portable Runtime - Time, Ring-0 Driver, Solaris.
4 */
5
6/*
7 * Copyright (C) 2006-2007 innotek GmbH
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18
19/*******************************************************************************
20* Header Files *
21*******************************************************************************/
22#include "the-solaris-kernel.h"
23#define RTTIME_INCL_TIMESPEC
24
25#include <iprt/time.h>
26
27
28/**
29 * Gets the current nanosecond timestamp.
30 *
31 * @returns nanosecond timestamp.
32 */
33RTDECL(uint64_t) RTTimeNanoTS(void)
34{
35 return gethrtime();
36}
37
38
39/**
40 * Gets the current millisecond timestamp.
41 *
42 * @returns millisecond timestamp.
43 */
44RTDECL(uint64_t) RTTimeMilliTS(void)
45{
46 return RTTimeNanoTS() / 1000;
47}
48
49
50/**
51 * Gets the current nanosecond timestamp.
52 *
53 * This differs from RTTimeNanoTS in that it will use system APIs and not do any
54 * resolution or performance optimizations.
55 *
56 * @returns nanosecond timestamp.
57 */
58RTDECL(uint64_t) RTTimeSystemNanoTS(void)
59{
60 return RTTimeNanoTS();
61}
62
63
64/**
65 * Gets the current millisecond timestamp.
66 *
67 * This differs from RTTimeNanoTS in that it will use system APIs and not do any
68 * resolution or performance optimizations.
69 *
70 * @returns millisecond timestamp.
71 */
72RTDECL(uint64_t) RTTimeSystemMilliTS(void)
73{
74 return RTTimeMilliTS();
75}
76
77
78/**
79 * Gets the current system time.
80 *
81 * @returns pTime.
82 * @param pTime Where to store the time.
83 */
84RTDECL(PRTTIMESPEC) RTTimeNow(PRTTIMESPEC pTime)
85{
86 /* timestruc_t is actually just a typedef struct timespec */
87 timestruc_t tv = tod_get();
88 return RTTimeSpecSetNano(pTime, (uint64_t)tv.tv_sec * 1000000000 + tv.tv_nsec);
89}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette