From bcef3aeb1e29b14df23500d9c0ce9c0b886e034f Mon Sep 17 00:00:00 2001 From: Christian Helmuth Date: Wed, 30 Jan 2019 13:59:46 +0100 Subject: [PATCH] dde_linux: fix calculation of ktime from jiffies --- repos/dde_linux/src/include/lx_emul/impl/timer.h | 2 +- repos/dde_linux/src/include/lx_emul/time.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/repos/dde_linux/src/include/lx_emul/impl/timer.h b/repos/dde_linux/src/include/lx_emul/impl/timer.h index c3dce2fd35..0c9da0d683 100644 --- a/repos/dde_linux/src/include/lx_emul/impl/timer.h +++ b/repos/dde_linux/src/include/lx_emul/impl/timer.h @@ -56,7 +56,7 @@ void hrtimer_init(struct hrtimer *timer, clockid_t clock_id, enum hrtimer_mode m int hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, unsigned long delta_ns, const enum hrtimer_mode mode) { - unsigned long expires = tim / (NSEC_PER_MSEC * HZ); + unsigned long expires = tim / ((1000/HZ) * NSEC_PER_MSEC); /* * Prevent truncation through rounding the values by adding 1 jiffy diff --git a/repos/dde_linux/src/include/lx_emul/time.h b/repos/dde_linux/src/include/lx_emul/time.h index 93351a48e8..5891e1ef51 100644 --- a/repos/dde_linux/src/include/lx_emul/time.h +++ b/repos/dde_linux/src/include/lx_emul/time.h @@ -80,7 +80,7 @@ static inline ktime_t ktime_add_ms(const ktime_t kt, const u64 msec) static inline ktime_t ktime_get(void) { - return (ktime_t){ (s64)jiffies * HZ * NSEC_PER_MSEC /* ns */ }; + return (ktime_t){ (s64)jiffies * (1000/HZ) * NSEC_PER_MSEC /* ns */ }; } static inline ktime_t ktime_set(const long sec, const unsigned long nsec)