TIMER: optimize time format conversion routine
This commit is contained in:
parent
a62789a505
commit
15885fdf6a
1 changed files with 4 additions and 2 deletions
|
@ -2128,8 +2128,10 @@ return ((double)time->tv_sec)+(double)(time->tv_nsec)/1000000000.0;
|
||||||
|
|
||||||
static void _double_to_timespec (struct timespec *time, double dtime)
|
static void _double_to_timespec (struct timespec *time, double dtime)
|
||||||
{
|
{
|
||||||
time->tv_sec = (time_t)floor(dtime);
|
double int_part = floor(dtime);
|
||||||
time->tv_nsec = (long)((dtime-floor(dtime))*1000000000.0);
|
|
||||||
|
time->tv_sec = (time_t)int_part;
|
||||||
|
time->tv_nsec = (long)((dtime - int_part)*1000000000.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
double sim_timenow_double (void)
|
double sim_timenow_double (void)
|
||||||
|
|
Loading…
Add table
Reference in a new issue