aboutsummaryrefslogtreecommitdiffstats
path: root/lib/timespec-sub.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/timespec-sub.c')
-rw-r--r--lib/timespec-sub.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/timespec-sub.c b/lib/timespec-sub.c
index 97c9f9de88c..b164a8380d0 100644
--- a/lib/timespec-sub.c
+++ b/lib/timespec-sub.c
@@ -29,7 +29,6 @@
29struct timespec 29struct timespec
30timespec_sub (struct timespec a, struct timespec b) 30timespec_sub (struct timespec a, struct timespec b)
31{ 31{
32 struct timespec r;
33 time_t rs = a.tv_sec; 32 time_t rs = a.tv_sec;
34 time_t bs = b.tv_sec; 33 time_t bs = b.tv_sec;
35 int ns = a.tv_nsec - b.tv_nsec; 34 int ns = a.tv_nsec - b.tv_nsec;
@@ -37,7 +36,7 @@ timespec_sub (struct timespec a, struct timespec b)
37 36
38 if (ns < 0) 37 if (ns < 0)
39 { 38 {
40 rns = ns + 1000000000; 39 rns = ns + TIMESPEC_RESOLUTION;
41 if (rs == TYPE_MINIMUM (time_t)) 40 if (rs == TYPE_MINIMUM (time_t))
42 { 41 {
43 if (bs <= 0) 42 if (bs <= 0)
@@ -65,7 +64,5 @@ timespec_sub (struct timespec a, struct timespec b)
65 else 64 else
66 rs -= bs; 65 rs -= bs;
67 66
68 r.tv_sec = rs; 67 return make_timespec (rs, rns);
69 r.tv_nsec = rns;
70 return r;
71} 68}