summaryrefslogtreecommitdiff
path: root/src/libstddjb/utc_from_tai.c
blob: 1e5e094713825285b82f20c4191ece1cf4e4be3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* ISC license. */

#include <errno.h>
#include <skalibs/uint64.h>
#include <skalibs/tai.h>
#include <skalibs/djbtime.h>
#include "djbtime-internal.h"

int utc_from_tai (uint64 *u, tai_t const *t)
{
  uint64 tt = t->x - 10 ;
  if (t->x < 10U) return (errno = EINVAL, 0) ;
  leapsecs_sub(&tt) ;
  *u = tt ;
  return 1 ;
}