changeset 10307:f1188b27894a

Obsoleted by timer-win2.c.
author diego
date Wed, 18 Jun 2003 14:29:04 +0000
parents b7464c68bef3
children b27f7db9bccb
files osdep/timer-win.c
diffstat 1 files changed, 0 insertions(+), 71 deletions(-) [+]
line wrap: on
line diff
--- a/osdep/timer-win.c	Wed Jun 18 10:08:54 2003 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <windows.h>
-#include <mmsystem.h>
-#include <sys/time.h>
-
-static LARGE_INTEGER qwTimerFrequency;
-static LARGE_INTEGER qwTimerStart;
-static LARGE_INTEGER m_lStartTime;
-static float m_fuSecsPerTick;
-static unsigned long RelativeTime = 0;
-
-int usec_sleep(int usec_delay)
-{
-    LARGE_INTEGER qwStartTicks, qwCurrTicks;
-    double dResult;
-    long lTick;
-    double fuSecDelay = ((float) usec_delay) / 1000000.0;
-
-    QueryPerformanceCounter(&qwStartTicks);
-    do {
-	QueryPerformanceCounter(&qwCurrTicks);
-	dResult =
-	    ((double) (qwCurrTicks.QuadPart - qwStartTicks.QuadPart)) /
-	    ((double) (qwTimerFrequency.QuadPart));
-    } while (dResult < fuSecDelay);
-}
-
-// Returns current time in microseconds
-unsigned long GetTimer()
-{
-    LARGE_INTEGER qwTime;
-    FLOAT fTime;
-    UINT64 uiQuadPart;
-
-    QueryPerformanceCounter(&qwTime);
-    qwTime.QuadPart -= m_lStartTime.QuadPart;
-    uiQuadPart = (UINT64) qwTime.QuadPart;
-    uiQuadPart /= ((UINT64) 10);	// prevent overflow after 4294.1 secs, now overflows after 42941 secs
-    fTime = ((FLOAT) (uiQuadPart)) / m_fuSecsPerTick;
-    return (unsigned long) fTime;
-}
-
-// Returns current time in microseconds
-float GetRelativeTime()
-{
-    unsigned long t, r;
-
-    t = GetTimer();
-    r = t - RelativeTime;
-    RelativeTime = t;
-    return (float) r *0.000001F;
-}
-
-// Returns current time in milliseconds
-unsigned int GetTimerMS()
-{
-    return GetTimer() / 1000;
-}
-
-void InitTimer()
-{
-    FLOAT t;
-
-    QueryPerformanceFrequency(&qwTimerFrequency);	// ticks/sec
-    m_fuSecsPerTick = (FLOAT) (((FLOAT) (qwTimerFrequency.QuadPart)) / 1000.0);	// tics/msec
-    m_fuSecsPerTick = (FLOAT) (m_fuSecsPerTick / 1000.0);	// ticks/usec
-    m_fuSecsPerTick /= 10.0;
-    QueryPerformanceCounter(&m_lStartTime);
-    t = GetRelativeTime();
-}