diff options
author | rpj <rpj> | 2005-06-12 00:28:03 +0000 |
---|---|---|
committer | rpj <rpj> | 2005-06-12 00:28:03 +0000 |
commit | 89004c42739c39f9546cd8c7ef6cfeaf7a838aa3 (patch) | |
tree | 10de3ea504a4af393f2229f5d61650eb56203629 /tests/stress1.c | |
parent | 13918de3623986d3f53b099becb9721abe5372f4 (diff) |
''
Diffstat (limited to 'tests/stress1.c')
-rw-r--r-- | tests/stress1.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/stress1.c b/tests/stress1.c index 68d2ed7..2562167 100644 --- a/tests/stress1.c +++ b/tests/stress1.c @@ -117,15 +117,17 @@ millisecondsFromNow (struct timespec * time, int millisecs) /* get current system time and add millisecs */ _ftime(&currSysTime); - nanosecs = ((int64_t) (millisecs + currSysTime.millitm)) * NANOSEC_PER_MILLISEC; + secs = (int64_t)(currSysTime.time + (millisecs / 1000)); + nanosecs = ((int64_t) (millisecs%1000 + currSysTime.millitm)) * NANOSEC_PER_MILLISEC; if (nanosecs >= NANOSEC_PER_SEC) { - secs = currSysTime.time + 1; - nanosecs %= NANOSEC_PER_SEC; + secs++; + nanosecs -= NANOSEC_PER_SEC; } - else + else if (nanosecs < 0) { - secs = currSysTime.time; + secs--; + nanosecs += NANOSEC_PER_SEC; } time->tv_nsec = (long)nanosecs; |