skalibs

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

localtmn_scan.c (365B)


      1 /* ISC license. */
      2 
      3 #include <skalibs/uint32.h>
      4 #include <skalibs/djbtime.h>
      5 
      6 size_t localtmn_scan (char const *s, localtmn *l)
      7 {
      8   localtmn m ;
      9   size_t n = localtm_scan(s, &m.tm) ;
     10   if (!n) return 0 ;
     11   s += n ;
     12   if (*s++ != '.') m.nano = 0 ;
     13   else
     14   {
     15     size_t b = uint32_scan(s, &m.nano) ;
     16     if (!b) return 0 ;
     17     n += b ;
     18   }
     19   *l = m ;
     20   return n ;
     21 }