[ fix ] Cast CLOCKS_PER_SEC to float before division

The cast to float needs to happen before the division, otherwise integer
division will be performed, and as a result `CLOCKS_PER_NSEC` will
always be 0 if `CLOCKS_PER_SEC` < `NSEC_PER_SEC`.
This commit is contained in:
Johann Rudloff 2021-05-29 17:35:40 +02:00 committed by G. Allais
parent 2a4197e909
commit 18e15e2261

View File

@ -1,7 +1,7 @@
#include "clock.h"
#define NSEC_PER_SEC 1000000000
#define CLOCKS_PER_NSEC ((float)(CLOCKS_PER_SEC / NSEC_PER_SEC))
#define CLOCKS_PER_NSEC ((float)CLOCKS_PER_SEC / NSEC_PER_SEC)
Value *clockTimeMonotonic()
{