* Parse the time string and return the reslution */
| 274 | * Parse the time string and return the reslution |
| 275 | */ |
| 276 | int msTimeGetResolution(const char *timestring) |
| 277 | { |
| 278 | int i=0; |
| 279 | |
| 280 | if (!timestring) |
| 281 | return -1; |
| 282 | |
| 283 | for(i=0; i<MS_NUMTIMEFORMATS; i++) |
| 284 | { |
| 285 | if(!ms_timeFormats[i].regex) |
| 286 | { |
| 287 | ms_timeFormats[i].regex = (ms_regex_t *) msSmallMalloc(sizeof(ms_regex_t)); |
| 288 | if(ms_regcomp(ms_timeFormats[i].regex, ms_timeFormats[i].pattern, |
| 289 | MS_REG_EXTENDED|MS_REG_NOSUB) != 0) |
| 290 | { |
| 291 | msSetError(MS_REGEXERR, "Failed to compile expression (%s).", "msParseTime()", ms_timeFormats[i].pattern); |
| 292 | return -1; |
| 293 | } |
| 294 | } |
| 295 | /* test the expression against the string */ |
| 296 | if(ms_regexec(ms_timeFormats[i].regex, timestring, 0, NULL, 0) == 0) |
| 297 | { /* match */ |
| 298 | return ms_timeFormats[i].resolution; |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | return -1; |
| 303 | } |
| 304 | |
| 305 | |
| 306 | int _msValidateTime(char *timestring, const char *timeextent) |
no test coverage detected