add LightsDriver_ActorMessage to win32 vs2008 project, fix Timer.cpp so it compiles...
authorPat <itgpmc@gmail.com>
Wed, 13 Apr 2011 02:49:47 +0000 (19:49 -0700)
committerPat <itgpmc@gmail.com>
Wed, 13 Apr 2011 02:49:47 +0000 (19:49 -0700)
src/StepMania-net2008.vcproj
src/timer/Timer.cpp
src/timer/Timer.h

index c6978d7..5ebb798 100644 (file)
                                                >\r
                                        </File>\r
                                        <File\r
+                                               RelativePath=".\arch\Lights\LightsDriver_ActorMessage.cpp"\r
+                                               >\r
+                                       </File>\r
+                                       <File\r
+                                               RelativePath=".\arch\Lights\LightsDriver_ActorMessage.h"\r
+                                               >\r
+                                       </File>\r
+                                       <File\r
                                                RelativePath=".\arch\Lights\LightsDriver_Dynamic.cpp"\r
                                                >\r
                                        </File>\r
                                        RelativePath="glext.h"\r
                                        >\r
                                </File>\r
+                               <File\r
+                                       RelativePath=".\timer\Timer.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\timer\Timer.h"\r
+                                       >\r
+                               </File>\r
                                <Filter\r
                                        Name="pcre"\r
                                        >\r
index dfbb648..643fe90 100644 (file)
@@ -1,12 +1,16 @@
 #include "Timer.h"
 
 ProfilingTimer::ProfilingTimer() {
-       elapsedSoFarInNS = 0;
-       lastStart = 0;
        isRunning = false;
+       elapsedSoFarInNS = 0;
+
 #ifdef _WINDOWS
        // This initializes the frequency of the ticks, which does not change.
-       QueryPerformanceFrequency(&frequency)
+       LARGE_INTEGER frequencyInfo;
+       QueryPerformanceFrequency(&frequencyInfo);
+       frequency = frequencyInfo.QuadPart;
+#else
+       lastStart = 0;
 #endif // _WINDOWS
 }
 
@@ -37,21 +41,21 @@ void ProfilingTimer::Stop() {
        QueryPerformanceCounter(&endTime);
        // frequency is ticks per second, 1 sec = 1 000 000 000 ns
        // ticks / (tics/sec) * (ns / sec) = ns
-       elapsedSoFarInNS += (endTime - lastStart) / frequency * 1000000000;
+       elapsedSoFarInNS += (endTime.QuadPart - lastStart.QuadPart) / frequency * 1000000000;
 #else
        timespec ts;
        clock_gettime(CLOCK_MONOTONIC, &ts);
        elapsedSoFarInNS += ts.tv_nsec - lastStart;
 #endif // _WINDOWS
 
-       lastStart = 0;
+       lastStart.QuadPart = 0;
        isRunning = false;
 }
 
 void ProfilingTimer::Reset() {
        // if running, stop
-       isRunning = 0;
-       lastStart = 0;
+       isRunning = false;
+       lastStart.QuadPart = 0;
 }
 
 double ProfilingTimer::GetElapsedSoFarInNS() const {
@@ -65,7 +69,7 @@ double ProfilingTimer::GetElapsedSoFarInNS() const {
        QueryPerformanceCounter(&curTime);
        // frequency is ticks per second, 1 sec = 1 000 000 000 ns
        // ticks / (tics/sec) * (ns / sec) = ns
-       LARGE_INTEGER curElapsed = elapsedSoFarInNS + ( (curTime - lastStart) / frequency * 1000000000 );
+       LONG curElapsed = elapsedSoFarInNS + ( (curTime.QuadPart - lastStart.QuadPart) / frequency * 1000000000 );
 #else
        timespec ts;
        clock_gettime(CLOCK_MONOTONIC, &ts);
@@ -78,7 +82,7 @@ double ProfilingTimer::GetElapsedSoFarInNS() const {
 double ProfilingTimer::GetElapsedSoFarInS() const {
        if (!isRunning) {
                // then we just return the current total
-               return (double) elapsedSoFarInNS / 1000000000;
+               return (double) elapsedSoFarInNS / 1000000000UL;
        }
 
 #ifdef _WINDOWS
@@ -86,7 +90,7 @@ double ProfilingTimer::GetElapsedSoFarInS() const {
        QueryPerformanceCounter(&curTime);
        // frequency is ticks per second, 1 sec = 1 000 000 000 ns
        // ticks / (tics/sec) * (ns / sec) = ns
-       LARGE_INTEGER curElapsed = elapsedSoFarInNS + ( (curTime - lastStart) / frequency * 1000000000 );
+       LONG curElapsed = elapsedSoFarInNS + ( (curTime.QuadPart - lastStart.QuadPart) / frequency * 1000000000UL );
 #else
        timespec ts;
        clock_gettime(CLOCK_MONOTONIC, &ts);
index 088b1b2..ebb5047 100644 (file)
@@ -42,8 +42,8 @@ class ProfilingTimer {
                bool isRunning;
 
 #ifdef _WINDOWS
-               LARGE_INTEGEER frequency;
-               LARGE_INTEGER elapsedSoFarInNS;
+               LONGLONG frequency;
+               LONG elapsedSoFarInNS;
                LARGE_INTEGER lastStart;
 #else // UNIX platforms
                long elapsedSoFarInNS;