VirtualBox

source: vbox/trunk/src/VBox/Runtime/timeprog.cpp@ 3680

Last change on this file since 3680 was 3123, checked in by vboxsync, 18 years ago

Made VBOX_LOG_FLAGS=msprog work in GC.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
1/* $Id: timeprog.cpp 3123 2007-06-15 14:46:16Z vboxsync $ */
2/** @file
3 * innotek Portable Runtime - Time Relative to Program Start.
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 * If you received this file as part of a commercial VirtualBox
18 * distribution, then only the terms of your commercial VirtualBox
19 * license agreement apply instead of the previous paragraph.
20 */
21
22
23/*******************************************************************************
24* Header Files *
25*******************************************************************************/
26#include <iprt/time.h>
27#include <iprt/assert.h>
28#include "internal/time.h"
29
30
31
32/**
33 * Get the nanosecond timestamp relative to program startup.
34 *
35 * @returns Timestamp relative to program startup.
36 */
37RTDECL(uint64_t) RTTimeProgramNanoTS(void)
38{
39 return RTTimeNanoTS() - g_u64ProgramStartNanoTS;
40}
41
42
43/**
44 * Get the microsecond timestamp relative to program startup.
45 *
46 * @returns Timestamp relative to program startup.
47 */
48RTDECL(uint64_t) RTTimeProgramMicroTS(void)
49{
50 return RTTimeProgramNanoTS() / 1000;
51}
52
53
54/**
55 * Get the millisecond timestamp relative to program startup.
56 *
57 * @returns Timestamp relative to program startup.
58 */
59RTDECL(uint64_t) RTTimeProgramMilliTS(void)
60{
61 return RTTimeMilliTS() - g_u64ProgramStartMilliTS;
62}
63
64
65/**
66 * Get the second timestamp relative to program startup.
67 *
68 * @returns Timestamp relative to program startup.
69 */
70RTDECL(uint32_t) RTTimeProgramSecTS(void)
71{
72 AssertMsg(g_u64ProgramStartMilliTS, ("RTR3Init hasn't been called!\n"));
73 return (uint32_t)(RTTimeProgramMilliTS() / 1000);
74}
75
76
77/**
78 * Get the RTTimeNanoTS() of when the program started.
79 *
80 * @returns Program startup timestamp.
81 */
82RTDECL(uint64_t) RTTimeProgramStartNanoTS(void)
83{
84 return g_u64ProgramStartNanoTS;
85}
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