| 128 | } |
| 129 | |
| 130 | static void test_av_small_strptime(void) |
| 131 | { |
| 132 | int i; |
| 133 | struct tm tm = { 0 }; |
| 134 | struct fmt_timespec_entry { |
| 135 | const char *fmt, *timespec; |
| 136 | } fmt_timespec_entries[] = { |
| 137 | { "%Y-%m-%d", "2012-12-21" }, |
| 138 | { "%Y - %m - %d", "2012-12-21" }, |
| 139 | { "%Y-%m-%d %H:%M:%S", "2012-12-21 20:12:21" }, |
| 140 | { " %Y - %m - %d %H : %M : %S", " 2012 - 12 - 21 20 : 12 : 21" }, |
| 141 | { " %Y - %b - %d %H : %M : %S", " 2012 - nOV - 21 20 : 12 : 21" }, |
| 142 | { " %Y - %B - %d %H : %M : %S", " 2012 - nOVemBeR - 21 20 : 12 : 21" }, |
| 143 | { " %Y - %B%d %H : %M : %S", " 2012 - may21 20 : 12 : 21" }, |
| 144 | { " %Y - %B%d %H : %M : %S", " 2012 - mby21 20 : 12 : 21" }, |
| 145 | { " %Y - %B - %d %H : %M : %S", " 2012 - JunE - 21 20 : 12 : 21" }, |
| 146 | { " %Y - %B - %d %H : %M : %S", " 2012 - Jane - 21 20 : 12 : 21" }, |
| 147 | { " %Y - %B - %d %H : %M : %S", " 2012 - January - 21 20 : 12 : 21" }, |
| 148 | }; |
| 149 | |
| 150 | av_log_set_level(AV_LOG_DEBUG); |
| 151 | for (i = 0; i < FF_ARRAY_ELEMS(fmt_timespec_entries); i++) { |
| 152 | char *p; |
| 153 | struct fmt_timespec_entry *e = &fmt_timespec_entries[i]; |
| 154 | printf("fmt:'%s' spec:'%s' -> ", e->fmt, e->timespec); |
| 155 | p = av_small_strptime(e->timespec, e->fmt, &tm); |
| 156 | if (p) { |
| 157 | printf("%04d-%02d-%2d %02d:%02d:%02d\n", |
| 158 | 1900+tm.tm_year, tm.tm_mon+1, tm.tm_mday, |
| 159 | tm.tm_hour, tm.tm_min, tm.tm_sec); |
| 160 | } else { |
| 161 | printf("error\n"); |
| 162 | } |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | static void test_av_parse_time(void) |
| 167 | { |
no test coverage detected