blob: 04746aa58a2d08c405177fc0e6a221d1195ac7c0 (
plain) (
tree)
|
|
/* See LICENSE file for copyright and license details. */
#include "libsimple.h"
int
libsimple_sumtimeval(struct timeval *sum, const struct timeval *augend, const struct timeval *addend)
{
struct timespec a, b, s;
int r;
libsimple_timeval2timespec(&a, augend);
libsimple_timeval2timespec(&b, addend);
r = libsimple_sumtimespec(&s, &a, &b);
if (r && errno != ERANGE)
return r;
return r | libsimple_timespec2timeval(sum, &s);
}
|