summaryrefslogtreecommitdiff
path: root/src/libstddjb/utc_from_tai.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstddjb/utc_from_tai.c')
-rw-r--r--src/libstddjb/utc_from_tai.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libstddjb/utc_from_tai.c b/src/libstddjb/utc_from_tai.c
index f4d247e..80d2763 100644
--- a/src/libstddjb/utc_from_tai.c
+++ b/src/libstddjb/utc_from_tai.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <errno.h>
#include <skalibs/uint64.h>
#include <skalibs/tai.h>
#include <skalibs/djbtime.h>
@@ -8,6 +9,7 @@
int utc_from_tai (uint64 *u, tai_t const *t)
{
uint64 tt = t->x - 10 ;
+ if (t->x < 10U) return (errno = EINVAL, 0) ;
if (leapsecs_sub(&tt) < 0) return 0 ;
*u = tt ;
return 1 ;