fix the issue of _timevalue.tv_usec initialization

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2471 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong@gmail.com 2012-12-08 15:26:43 +00:00
parent 6d78189f1b
commit c1df311d5a
1 changed files with 15 additions and 1 deletions

View File

@ -1,3 +1,17 @@
/*
* File : clock_time.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2012, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2012-12-08 Bernard fix the issue of _timevalue.tv_usec initialization,
* which found by Rob <rdent@iinet.net.au>
*/
#include <rtthread.h>
#include <pthread.h>
@ -19,7 +33,7 @@ void clock_time_system_init()
/* get tick */
tick = rt_tick_get();
_timevalue.tv_usec = MICROSECOND_PER_SECOND - (tick%RT_TICK_PER_SECOND) * MICROSECOND_PER_TICK;
_timevalue.tv_usec = (tick%RT_TICK_PER_SECOND) * MICROSECOND_PER_TICK;
_timevalue.tv_sec = time - tick/RT_TICK_PER_SECOND - 1;
}