tstrtotm.c - plan9port - [fork] Plan 9 from user space
git clone git://src.adamsgaard.dk/plan9port
Log
Files
Refs
README
LICENSE
---
tstrtotm.c (1902B)
---
     1 #include 
     2 #include 
     3 #include 
     4 
     5 static char*
     6 skiptext(char *q)
     7 {
     8         while(*q!='\0' && *q!=' ' && *q!='\t' && *q!='\r' && *q!='\n')
     9                 q++;
    10         return q;
    11 }
    12 
    13 static char*
    14 skipwhite(char *q)
    15 {
    16         while(*q==' ' || *q=='\t' || *q=='\r' || *q=='\n')
    17                 q++;
    18         return q;
    19 }
    20 
    21 static char* months[] = {
    22         "jan", "feb", "mar", "apr",
    23         "may", "jun", "jul", "aug",
    24         "sep", "oct", "nov", "dec"
    25 };
    26 
    27 static int
    28 strcmplwr(char *a, char *b, int n)
    29 {
    30         char *eb;
    31 
    32         eb = b+n;
    33         while(*a && *b && b= 1900)
   102                                 tm.year = j-1900;
   103                 }
   104         }
   105 
   106         if(tm.mon<0 || tm.year<0
   107         || tm.hour<0 || tm.min<0
   108         || tm.mday<0)
   109                 return -1;
   110 
   111         *tmp = *localtime(tm2sec(&tm)-delta);
   112         return 0;
   113 }