MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / av_small_strptime

Function av_small_strptime

libavutil/parseutils.c:494–571  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

492}
493
494char *av_small_strptime(const char *p, const char *fmt, struct tm *dt)
495{
496 int c, val;
497
498 while((c = *fmt++)) {
499 if (c != '%') {
500 if (av_isspace(c))
501 for (; *p && av_isspace(*p); p++);
502 else if (*p != c)
503 return NULL;
504 else p++;
505 continue;
506 }
507
508 c = *fmt++;
509 switch(c) {
510 case 'H':
511 case 'J':
512 val = date_get_num(&p, 0, c == 'H' ? 23 : INT_MAX, c == 'H' ? 2 : 4);
513
514 if (val == -1)
515 return NULL;
516 dt->tm_hour = val;
517 break;
518 case 'M':
519 val = date_get_num(&p, 0, 59, 2);
520 if (val == -1)
521 return NULL;
522 dt->tm_min = val;
523 break;
524 case 'S':
525 val = date_get_num(&p, 0, 59, 2);
526 if (val == -1)
527 return NULL;
528 dt->tm_sec = val;
529 break;
530 case 'Y':
531 val = date_get_num(&p, 0, 9999, 4);
532 if (val == -1)
533 return NULL;
534 dt->tm_year = val - 1900;
535 break;
536 case 'm':
537 val = date_get_num(&p, 1, 12, 2);
538 if (val == -1)
539 return NULL;
540 dt->tm_mon = val - 1;
541 break;
542 case 'd':
543 val = date_get_num(&p, 1, 31, 2);
544 if (val == -1)
545 return NULL;
546 dt->tm_mday = val;
547 break;
548 case 'T':
549 p = av_small_strptime(p, "%H:%M:%S", dt);
550 if (!p)
551 return NULL;

Callers 4

parse_http_dateFunction · 0.85
ftp_parse_dateFunction · 0.85
av_parse_timeFunction · 0.85
test_av_small_strptimeFunction · 0.85

Calls 3

av_isspaceFunction · 0.85
date_get_numFunction · 0.85
date_get_monthFunction · 0.85

Tested by 1

test_av_small_strptimeFunction · 0.68