skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

sysclock_from_utc.c (404B)


      1 /* ISC license. */
      2 
      3 #include <errno.h>
      4 #include <skalibs/config.h>
      5 #include <skalibs/uint64.h>
      6 #include <skalibs/djbtime.h>
      7 
      8 #ifdef SKALIBS_FLAG_CLOCKISTAI
      9 
     10 int sysclock_from_utc (uint64_t *u)
     11 {
     12   tai t ;
     13   if (!tai_from_utc(&t, *u)) return 0 ;
     14   if (t.x < 10) return (errno = EINVAL, 0) ;
     15   *u = t.x - 10 ;
     16   return 1 ;
     17 }
     18 
     19 #else
     20 
     21 int sysclock_from_utc (uint64_t *u)
     22 {
     23   (void)u ;
     24   return 1 ;
     25 }
     26 
     27 #endif