From ca25787c459677b82479326d3b0554d141586a7c Mon Sep 17 00:00:00 2001 From: Thulinma Date: Wed, 19 Sep 2012 15:31:43 +0200 Subject: [PATCH] In soviet russia, stupid mistakes fix YOU. --- lib/timing.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/timing.cpp b/lib/timing.cpp index cc03d0ff..8d7a5f97 100644 --- a/lib/timing.cpp +++ b/lib/timing.cpp @@ -11,16 +11,15 @@ void Util::sleep(int ms){ if (ms > 10000){return;} struct timespec T; T.tv_sec = ms/1000; - T.tv_nsec = 1000*(ms%1000); + T.tv_nsec = 1000000*(ms%1000); nanosleep(&T, 0); } /// Gets the current time in milliseconds. long long int Util::getMS(){ - /// \todo Possibly change to use clock_gettime - needs -lrt though... struct timespec t; clock_gettime(CLOCK_REALTIME, &t); - return ((long long int)t.tv_sec) * 1000 + t.tv_nsec/1000; + return ((long long int)t.tv_sec) * 1000 + t.tv_nsec/1000000; } /// Gets the amount of seconds since 01/01/1970.