time-win32.cpp revision 9aa6fbc4da65d57d07aadef838a1b032bd659c0f
/* $Id$ */
/** @file
* InnoTek Portable Runtime - Time, win32.
*/
/*
* Copyright (C) 2006 InnoTek Systemberatung GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License as published by the Free Software Foundation,
* in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
* distribution. VirtualBox OSE is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY of any kind.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#define LOG_GROUP RTLOGGROUP_TIME
//#define USE_TICK_COUNT
//#define USE_PERFORMANCE_COUNTER
#define USE_FILE_TIME
//#define USE_INTERRUPT_TIME
#ifndef USE_INTERRUPT_TIME
# include <Windows.h>
#else
# define _X86_
extern "C" {
# include <ntddk.h>
}
#endif
{
#if defined USE_TICK_COUNT
#elif defined USE_PERFORMANCE_COUNTER
static LARGE_INTEGER llFreq;
static unsigned uMult;
{
if (!QueryPerformanceFrequency(&llFreq))
}
if (QueryPerformanceCounter(&ll))
else
#elif defined USE_FILE_TIME
return u64 * 100;
#elif defined USE_INTERRUPT_TIME
/* HACK! HACK! HACK! HACK! HACK! HACK! */
/* HACK! HACK! HACK! HACK! HACK! HACK! */
/* HACK! HACK! HACK! HACK! HACK! HACK! */
# error "don't use this in production"
if (!s_pUserSharedData)
{
/** @todo clever detection algorithm.
* The com debugger class exports this too, windbg knows it too... */
}
/* use interrupt time */
do
{
#else
# error "Must select a method bright guy!"
#endif
}
/**
* Gets the current nanosecond timestamp.
*
* This differs from RTTimeNanoTS in that it will use system APIs and not do any
* resolution or performance optimizations.
*
* @returns nanosecond timestamp.
*/
{
return rtTimeGetSystemNanoTS();
}
/**
* Gets the current millisecond timestamp.
*
* This differs from RTTimeNanoTS in that it will use system APIs and not do any
* resolution or performance optimizations.
*
* @returns millisecond timestamp.
*/
{
return rtTimeGetSystemNanoTS();
}
/**
* Gets the current system time.
*
* @returns pTime.
* @param pTime Where to store the time.
*/
{
}
/**
* Gets the current local system time.
*
* @returns pTime.
* @param pTime Where to store the local time.
*/
{
}
/**
* Gets the delta between UTC and local time.
*
* @code
* RTTIMESPEC LocalTime;
* RTTimeSpecAddNano(RTTimeNow(&LocalTime), RTTimeLocalDeltaNano());
* @endcode
*
* @returns Returns the nanosecond delta between UTC and local time.
*/
{
/*
* UCT = local + Tzi.Bias;
* The bias is given in minutes.
*/
return 0;
}
/**
* Explodes a time spec to the localized timezone.
*
* @returns pTime.
* @param pTime Where to store the exploded time.
* @param pTimeSpec The time spec to exploded. (UCT)
*/
{
/*
* FileTimeToLocalFileTime does not do the right thing, so we'll have
* to convert to system time and SystemTimeToTzSpecificLocalTime instead.
*/
{
{
{
}
}
}
/*
* The fallback is to use the current offset.
* (A better fallback would be to use the offset of the same time of the year.)
*/
}