72 // skip leading spaces |
72 // skip leading spaces |
73 while(isspace(*str)) { |
73 while(isspace(*str)) { |
74 str++; |
74 str++; |
75 } |
75 } |
76 |
76 |
77 // ensure we have numeric values (maybe with sign) |
77 // ensure we have numeric values |
78 if(!isdigit(*str) && *str != '-' && *str != '+') { |
78 if(!isdigit(*str)) { |
79 return 1; |
79 return 1; |
80 } |
80 } |
81 |
81 |
82 // starting parsing the year |
82 // starting parsing the year |
83 val = strtoul(str, &str, 10); |
83 val = strtoul(str, &str, 10); |
86 // month (and day) seem to be dash separated |
86 // month (and day) seem to be dash separated |
87 tparts.tm_year = val - 1900; |
87 tparts.tm_year = val - 1900; |
88 str++; |
88 str++; |
89 tparts.tm_mon = strtoul(str, &str, 10) - 1; |
89 tparts.tm_mon = strtoul(str, &str, 10) - 1; |
90 |
90 |
91 if (*str++ != '-') { |
91 if(*str++ != '-') { |
92 return 1; |
92 return 1; |
93 } |
93 } |
94 |
94 |
95 tparts.tm_mday = strtoul(str, &str, 10); |
95 tparts.tm_mday = strtoul(str, &str, 10); |
96 } else { |
96 } else { |