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

Function _msValidateTime

maptime.c:306–418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

304
305
306int _msValidateTime(char *timestring, const char *timeextent)
307{
308 int numelements, numextents, i, numranges;
309 struct tm tmtimestart, tmtimeend, tmstart, tmend;
310 char **atimerange = NULL, **atimeelements= NULL, **atimeextents=NULL;
311
312 if (!timestring || !timeextent)
313 return MS_FALSE;
314
315 if (strlen(timestring) <= 0 ||
316 strlen(timeextent) <= 0)
317 return MS_FALSE;
318
319
320 /* we first need to parse the timesting that is passed
321 so that we can determine if it is a descrete time
322 or a range */
323
324 numelements = 0;
325 atimeelements = msStringSplit (timestring, '/', &numelements);
326 msTimeInit(&tmtimestart);
327 msTimeInit(&tmtimeend);
328
329 if (numelements == 1) /*descrete time*/
330 {
331 /*start end end times are the same*/
332 if (msParseTime(timestring, &tmtimestart) != MS_TRUE)
333 {
334 msFreeCharArray(atimeelements, numelements);
335 return MS_FALSE;
336 }
337 if (msParseTime(timestring, &tmtimeend) != MS_TRUE)
338 {
339 msFreeCharArray(atimeelements, numelements);
340 return MS_FALSE;
341 }
342 }
343 else if (numelements >=2)/*range */
344 {
345 if (msParseTime(atimeelements[0], &tmtimestart) != MS_TRUE)
346 {
347 msFreeCharArray(atimeelements, numelements);
348 return MS_FALSE;
349 }
350 if (msParseTime(atimeelements[1], &tmtimeend) != MS_TRUE)
351 {
352 msFreeCharArray(atimeelements, numelements);
353 return MS_FALSE;
354 }
355 }
356
357 msFreeCharArray(atimeelements, numelements);
358
359
360 /* Now parse the time extent. Extents can be
361 - one range (2004-09-21/2004-09-25/resolution)
362 - multiple rages 2004-09-21/2004-09-25/res1,2004-09-21/2004-09-25/res2
363 - one value 2004-09-21

Callers 1

msValidateTimeValueFunction · 0.85

Calls 5

msStringSplitFunction · 0.85
msTimeInitFunction · 0.85
msParseTimeFunction · 0.85
msFreeCharArrayFunction · 0.85
msTimeCompareFunction · 0.85

Tested by

no test coverage detected