summaryrefslogtreecommitdiff
path: root/lib/timespec-add.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2013-09-19 14:40:08 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2013-09-19 14:40:08 -0700
commit230fe2a5a10f2bc128f354e3fb1b48536b1f143b (patch)
treeb282d5f242b8ada877d188d03d43da78b175d67a /lib/timespec-add.c
parentc39cc7d149d28060c40bc206eb8a63f7a0636301 (diff)
downloademacs-230fe2a5a10f2bc128f354e3fb1b48536b1f143b.tar.gz
Merge from gnulib.
This incorporates the following changes: 2013-09-19 stdio: OS X port of putc_unlocked + extern inline 2013-09-19 signal: OS X port of sigaddset etc. + extern inline 2013-09-19 extern-inline: do not always suppress extern inline on OS X 2013-09-17 getgroups: statement without effect 2013-08-28 headers: check that _GL_INLINE_HEADER_BEGIN is defined
Diffstat (limited to 'lib/timespec-add.c')
-rw-r--r--lib/timespec-add.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/timespec-add.c b/lib/timespec-add.c
index 6ce2c73064f..51323a63207 100644
--- a/lib/timespec-add.c
+++ b/lib/timespec-add.c
@@ -28,11 +28,10 @@
struct timespec
timespec_add (struct timespec a, struct timespec b)
{
- struct timespec r;
time_t rs = a.tv_sec;
time_t bs = b.tv_sec;
int ns = a.tv_nsec + b.tv_nsec;
- int nsd = ns - 1000000000;
+ int nsd = ns - TIMESPEC_RESOLUTION;
int rns = ns;
if (0 <= nsd)
@@ -65,7 +64,5 @@ timespec_add (struct timespec a, struct timespec b)
else
rs += bs;
- r.tv_sec = rs;
- r.tv_nsec = rns;
- return r;
+ return make_timespec (rs, rns);
}