summaryrefslogtreecommitdiff
path: root/src/libstddjb/sysclock_from_utc.c
blob: 49228a7723af10246d664d7742f47fdaff4455d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* ISC license. */

#include <errno.h>
#include <skalibs/config.h>
#include <skalibs/uint64.h>
#include <skalibs/djbtime.h>

#ifdef SKALIBS_FLAG_CLOCKISTAI

#include <skalibs/tai.h>

int sysclock_from_utc (uint64 *u)
{
  tai_t t ;
  if (!tai_from_utc(&t, *u)) return 0 ;
  if (t.x < 10) return (errno = EINVAL, 0) ;
  *u = t.x - 10 ;
  return 1 ;
}

#else

int sysclock_from_utc (uint64 *u)
{
  (void)u ;
  return 1 ;
}

#endif