mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +00:00
Remove unused pnUtTime functions.
This commit is contained in:
@ -58,9 +58,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
namespace pnUtilsExe {
|
||||
|
||||
uint32_t TimeGetTickCount () {
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Exports
|
||||
*
|
||||
***/
|
||||
|
||||
uint32_t TimeGetMs () {
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
return GetTickCount();
|
||||
#else
|
||||
@ -71,75 +76,3 @@ uint32_t TimeGetTickCount () {
|
||||
return (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Time adjustment functions
|
||||
*
|
||||
* For debug builds, adjust the initial time value so that the high
|
||||
* bit or the time value itself is about to wrap, to catch application
|
||||
* bugs that don't handle wrapping or depend on the high bit's value.
|
||||
*
|
||||
***/
|
||||
|
||||
static uint32_t s_adjustment;
|
||||
|
||||
//===========================================================================
|
||||
static void InitializeAdjustment () {
|
||||
ASSERT(!s_adjustment);
|
||||
uint32_t currTime = TimeGetTickCount();
|
||||
uint32_t startBits = (currTime & 0x80) ? 0x7fff0000 : 0xffff0000;
|
||||
uint32_t startMask = 0xffff0000;
|
||||
s_adjustment = (((currTime & ~startMask) | startBits) - currTime) | 1;
|
||||
ASSERT(s_adjustment);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
AUTO_INIT_FUNC(AutoInitializeAdjustment) {
|
||||
if (!s_adjustment)
|
||||
InitializeAdjustment();
|
||||
}
|
||||
|
||||
} using namespace pnUtilsExe;
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Exports
|
||||
*
|
||||
***/
|
||||
|
||||
uint32_t TimeGetSecondsSince2001Utc () {
|
||||
uint64_t time = TimeGetTime();
|
||||
uint32_t seconds = (uint32_t)((time - kTime1601To2001) / kTimeIntervalsPerSecond);
|
||||
return seconds;
|
||||
}
|
||||
|
||||
uint64_t TimeGetTime () {
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
uint64_t time;
|
||||
static_assert(sizeof(uint64_t) == sizeof(FILETIME), "FILETIME is not a uint64");
|
||||
GetSystemTimeAsFileTime((FILETIME *) &time);
|
||||
return time;
|
||||
#else
|
||||
struct timespec ts;
|
||||
if (clock_gettime(CLOCK_MONOTONIC, &ts))
|
||||
return 0;
|
||||
|
||||
long long time = ts.tv_sec * 1000000000LL + ts.tv_nsec;
|
||||
|
||||
return time / 100;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t TimeGetMs () {
|
||||
#ifdef HS_DEBUGGING
|
||||
// For debug builds, return an adjusted timer value
|
||||
if (!s_adjustment)
|
||||
InitializeAdjustment();
|
||||
return TimeGetTickCount() + s_adjustment;
|
||||
#else
|
||||
// For release builds, just return the operating system's timer
|
||||
return TimeGetTickCount();
|
||||
#endif
|
||||
}
|
||||
|
@ -55,24 +55,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
* Time query functions
|
||||
*
|
||||
***/
|
||||
|
||||
const uint64_t kTimeIntervalsPerMs = 10000;
|
||||
const uint64_t kTimeIntervalsPerSecond = 1000 * kTimeIntervalsPerMs;
|
||||
const uint64_t kTimeIntervalsPerMinute = 60 * kTimeIntervalsPerSecond;
|
||||
const uint64_t kTimeIntervalsPerHour = 60 * kTimeIntervalsPerMinute;
|
||||
const uint64_t kTimeIntervalsPerDay = 24 * kTimeIntervalsPerHour;
|
||||
|
||||
// millisecond timer; wraps ~49 days
|
||||
uint32_t TimeGetMs ();
|
||||
|
||||
// 100 nanosecond intervals; won't wrap in our lifetimes
|
||||
uint64_t TimeGetTime ();
|
||||
|
||||
// Seconds elapsed since 00:00:00 January 1, 2001 UTC
|
||||
uint32_t TimeGetSecondsSince2001Utc ();
|
||||
|
||||
|
||||
// These magic numbers taken from Microsoft's "Shared Source CLI implementation" source code.
|
||||
// http://msdn.microsoft.com/library/en-us/Dndotnet/html/mssharsourcecli.asp
|
||||
static const uint64_t kTime1601To2001 = 12622780800 * kTimeIntervalsPerSecond;
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user