summaryrefslogtreecommitdiff
path: root/lib/timespec-sub.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-sub.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-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 @@
struct timespec
timespec_sub (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;
@@ -37,7 +36,7 @@ timespec_sub (struct timespec a, struct timespec b)
if (ns < 0)
{
- rns = ns + 1000000000;
+ rns = ns + TIMESPEC_RESOLUTION;
if (rs == TYPE_MINIMUM (time_t))
{
if (bs <= 0)
@@ -65,7 +64,5 @@ timespec_sub (struct timespec a, struct timespec b)
else
rs -= bs;
- r.tv_sec = rs;
- r.tv_nsec = rns;
- return r;
+ return make_timespec (rs, rns);
}