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

Function msTimeMatchPattern

maptime.c:152–177  ·  view source on GitHub ↗

return MS_TRUE if the time string matchs the timeformat. else return MS_FALSE. */

Source from the content-addressed store, hash-verified

150 else return MS_FALSE.
151 */
152int msTimeMatchPattern(char *timestring, char *timeformat)
153{
154 int i =-1;
155
156 /* match the pattern format first and then check if the time string */
157 /* matchs the pattern. If it is the case retrurn the MS_TRUE */
158 for (i=0; i<MS_NUMTIMEFORMATS; i++)
159 {
160 if (strcasecmp(ms_timeFormats[i].userformat, timeformat) == 0)
161 break;
162 }
163
164 if (i >= 0 && i < MS_NUMTIMEFORMATS)
165 {
166 if(!ms_timeFormats[i].regex)
167 {
168 ms_timeFormats[i].regex = (ms_regex_t *) msSmallMalloc(sizeof(ms_regex_t));
169 ms_regcomp(ms_timeFormats[i].regex,
170 ms_timeFormats[i].pattern, MS_REG_EXTENDED|MS_REG_NOSUB);
171 }
172 if (ms_regexec(ms_timeFormats[i].regex, timestring, 0,NULL, 0) == 0)
173 return MS_TRUE;
174
175 }
176 return MS_FALSE;
177}
178
179
180void msUnsetLimitedPatternToUse()

Callers 1

msWMSSetTimePatternFunction · 0.85

Calls 4

strcasecmpFunction · 0.85
msSmallMallocFunction · 0.85
ms_regcompFunction · 0.70
ms_regexecFunction · 0.70

Tested by

no test coverage detected