MCPcopy Index your code
hub / github.com/MapServer/MapServer / msTimeGetResolution

Function msTimeGetResolution

maptime.c:276–303  ·  view source on GitHub ↗

* Parse the time string and return the reslution */

Source from the content-addressed store, hash-verified

274 * Parse the time string and return the reslution
275 */
276int 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
306int _msValidateTime(char *timestring, const char *timeextent)

Callers 1

Calls 4

msSmallMallocFunction · 0.85
msSetErrorFunction · 0.85
ms_regcompFunction · 0.70
ms_regexecFunction · 0.70

Tested by

no test coverage detected