From 912549153ab8927b13ea2e5c9a3b5eb304e9746a Mon Sep 17 00:00:00 2001 From: Colden Cullen Date: Sun, 20 Apr 2014 18:47:45 -0400 Subject: [PATCH] Fixed total time being horridly broken. --- source/utility/time.d | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/source/utility/time.d b/source/utility/time.d index 23ff01c9..0d77d86f 100644 --- a/source/utility/time.d +++ b/source/utility/time.d @@ -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; @@ -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; @@ -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; }