summaryrefslogtreecommitdiff
path: root/src/libstddjb/tain_from_millisecs.c
blob: 8978aa3331b43f36817e11e46b4f4647f4538156 (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 *a, int millisecs)
{
  if (millisecs < 0) return (errno = EINVAL, 0) ;
  a->sec.x = millisecs / 1000 ;
  a->nano = (millisecs % 1000) * 1000000U ;
  return 1 ;
}