diff options
Diffstat (limited to 'strtotimeval.c')
-rw-r--r-- | strtotimeval.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/strtotimeval.c b/strtotimeval.c new file mode 100644 index 0000000..e210e87 --- /dev/null +++ b/strtotimeval.c @@ -0,0 +1,13 @@ +/* See LICENSE file for copyright and license details. */ +#include "libsimple.h" + + +int +libsimple_strtotimeval(struct timeval *restrict tv, const char *restrict s, char **restrict end) +{ + struct timespec ts; + int r = libsimple_strtotimespec(&ts, s, end); + if (r && errno != ERANGE) + return r; + return r | libsimple_timespec2timeval(tv, &ts); +} |