Skip to content

Commit

Permalink
Fixed total time being horridly broken.
Browse files Browse the repository at this point in the history
  • Loading branch information
ColdenCullen committed Apr 20, 2014
1 parent 05fa38b commit 9125491
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions source/utility/time.d
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import std.datetime;
*/
float toSeconds( Duration dur )
{
return cast(float)dur.fracSec.hnsecs / cast(float)1.convert!( "seconds", "hnsecs" );
return cast(float)dur.total!"hnsecs" / cast(float)1.convert!( "seconds", "hnsecs" );
}

shared TimeManager Time;
Expand Down Expand Up @@ -93,6 +93,13 @@ void updateTime()

delta = cast(Duration)( cur - prev );

prev = cur;
cur = sw.peek();

// Pass to shared values
cast()Time.total = cast(Duration)cur;
cast()Time.delta = delta;

// Update framerate
++frameCount;
second += delta;
Expand All @@ -102,11 +109,4 @@ void updateTime()
second = Duration.zero;
frameCount = 0;
}

prev = cur;
cur = sw.peek();

// Pass to shared values
cast()Time.delta = delta;
cast()Time.total += delta;
}

0 comments on commit 9125491

Please sign in to comment.