Fix math error in sleep calculation.

This commit is contained in:
Ian Gulliver
2016-03-04 20:07:23 -08:00
parent 85f1933f9b
commit db4c47a92d

View File

@@ -311,11 +311,12 @@ int main(int argc, char *argv[]) {
file_open();
#define NS_PER_S 1000000000
#define MS_PER_S 1000
#define NS_PER_MS 1000000
uint64_t cycle_ns = config.cycle_ms * NS_PER_MS;
struct timespec ts = {
.tv_sec = cycle_ns / NS_PER_S,
.tv_nsec = (config.cycle_ms * NS_PER_MS) % NS_PER_S,
.tv_nsec = (config.cycle_ms % MS_PER_S) * NS_PER_MS,
};
while (!shutdown_flag) {