summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e233401)
raw | patch | inline | side by side (parent: e233401)
author | Rinigus <rinigus.git@gmail.com> | |
Fri, 5 Aug 2016 12:16:18 +0000 (15:16 +0300) | ||
committer | Rinigus <rinigus.git@gmail.com> | |
Fri, 5 Aug 2016 12:16:18 +0000 (15:16 +0300) |
src/cpusleep.c | patch | blob | history |
diff --git a/src/cpusleep.c b/src/cpusleep.c
index 9a0e17eeca17a5b1ff2ceeebc36376f262a7c45b..4d3547a4019be1532cc55024bf41fd1196853f06 100644 (file)
--- a/src/cpusleep.c
+++ b/src/cpusleep.c
// to avoid false positives in counter overflow due to reboot,
// derive is used. Sleep is calculated in milliseconds
- derive_t sleep = (derive_t) ((b.tv_sec - m.tv_sec)*1e3 + (b.tv_nsec - m.tv_nsec)*1e-6);
+ derive_t diffsec = b.tv_sec - m.tv_sec;
+ derive_t diffnsec = b.tv_nsec - m.tv_nsec;
+ derive_t sleep = diffsec * 1000 + diffnsec / 1000000;
cpusleep_submit(sleep);