mirror of
https://github.com/simh/simh.git
synced 2026-01-25 11:46:37 +00:00
TIMER: optimize time format conversion routine
This commit is contained in:
@@ -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)
|
||||
{
|
||||
time->tv_sec = (time_t)floor(dtime);
|
||||
time->tv_nsec = (long)((dtime-floor(dtime))*1000000000.0);
|
||||
double int_part = floor(dtime);
|
||||
|
||||
time->tv_sec = (time_t)int_part;
|
||||
time->tv_nsec = (long)((dtime - int_part)*1000000000.0);
|
||||
}
|
||||
|
||||
double sim_timenow_double (void)
|
||||
|
||||
Reference in New Issue
Block a user