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

#include <sys/types.h>
#include <time.h>
#include <skalibs/tai.h>

int timespec_from_tain (struct timespec *ts, tain_t const *a)
{
  struct timespec tmp ;
  if (!timespec_from_tai(&tmp, tain_secp(a))) return 0 ;
  ts->tv_sec = tmp.tv_sec ;
  ts->tv_nsec = a->nano ;
  return 1 ;
}