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

#include <errno.h>
#include <skalibs/tai.h>

int tain_from_millisecs (tain_t *a, int millisecs)
{
  if (millisecs < 0) return (errno = EINVAL, 0) ;
  a->sec.x = millisecs / 1000 ;
  a->nano = (millisecs % 1000) * 1000000U ;
  return 1 ;
}