skalibs

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

tain_from_millisecs.c (257B)


      1 /* ISC license. */
      2 
      3 #include <errno.h>
      4 #include <skalibs/tai.h>
      5 
      6 int tain_from_millisecs (tain *a, int millisecs)
      7 {
      8   if (millisecs < 0) return (errno = EINVAL, 0) ;
      9   a->sec.x = millisecs / 1000 ;
     10   a->nano = (millisecs % 1000) * 1000000U ;
     11   return 1 ;
     12 }