From: Arjen Baart Date: Fri, 4 Sep 2020 06:02:00 +0000 (+0200) Subject: Bugfix: accelleration is divided twice X-Git-Url: http://www.andromeda.nl/gitweb/?a=commitdiff_plain;p=Tachyon.git Bugfix: accelleration is divided twice --- diff --git a/src/Tachyon.cpp b/src/Tachyon.cpp index 5a32f9a..51b7f8f 100644 --- a/src/Tachyon.cpp +++ b/src/Tachyon.cpp @@ -265,7 +265,7 @@ int Tachyon::nanosleep(float req) virt_time = gettime(); - seconds = req / accelleration; + seconds = req; nanoseconds = (seconds - trunc(seconds)) * 1.0e9; req_t.tv_sec = trunc(seconds); @@ -302,7 +302,7 @@ int Tachyon::sleep_until(timespec ends_at) period.tv_sec = trunc(seconds); period.tv_nsec = trunc(nanoseconds); - //printf("Sleeping for : %d,%d\n", period.tv_sec, period.tv_nsec); + //printf("Tachyon: Sleeping for : %d,%d\n", period.tv_sec, period.tv_nsec); errno = 0; sleep_return = ::nanosleep(&period, &remaining); //printf("nanosleep returns %d, error = %s\n", sleep_return, strerror(errno)); diff --git a/test/accellerate_float b/test/accellerate_float index 8ff7325..b04401f 100755 --- a/test/accellerate_float +++ b/test/accellerate_float @@ -15,9 +15,9 @@ duration=$(($END_TIME - $START_TIME)) echo "Elapsed time is $duration" cat sleep.tmp -if [[ $duration -eq 1 ]] || [[ $duration -eq 2 ]] +if [[ $duration -eq 2 ]] || [[ $duration -eq 3 ]] then - echo "Elapsed time within 2 seconds" + echo "Elapsed time within 3 seconds" exit 0 fi echo "Elapsed time $duration seconds is unexpected."