clock: fix incorrect calculation on timespec
authorHeesub Shin <heesub.shin@samsung.com>
Wed, 17 May 2017 03:54:37 +0000 (12:54 +0900)
committerHeesub Shin <heesub.shin@samsung.com>
Tue, 23 May 2017 12:40:04 +0000 (21:40 +0900)
Here, TICK2USEC() should be used instead of TICK2MSEC(). This results in
a subtle bug that incorrectly calculating timespec when period of the
system clock tick is not divided evenly by 1000us.

Change-Id: Idde97d06108dfff6b96327a48f3aa7817a8542e4
Signed-off-by: Heesub Shin <heesub.shin@samsung.com>
os/kernel/clock/clock_systimespec.c

index 59ded34..db7ca5b 100644 (file)
@@ -165,7 +165,7 @@ int clock_systimespec(FAR struct timespec *ts)
 
                /* Get the time since power-on in seconds and milliseconds */
 
-               usecs = TICK2MSEC(clock_systimer());
+               usecs = TICK2USEC(clock_systimer());
                secs  = usecs / USEC_PER_SEC;
 
                /* Return the elapsed time in seconds and nanoseconds */