| 164 | } |
| 165 | |
| 166 | static void test_av_parse_time(void) |
| 167 | { |
| 168 | int i; |
| 169 | int64_t tv; |
| 170 | time_t tvi; |
| 171 | struct tm *tm; |
| 172 | static char tzstr[] = "TZ=CET-1"; |
| 173 | static const char * const time_string[] = { |
| 174 | "now", |
| 175 | "12:35:46", |
| 176 | "2000-12-20 0:02:47.5z", |
| 177 | "2012 - 02-22 17:44:07", |
| 178 | "2000-12-20T010247.6", |
| 179 | "2000-12-12 1:35:46+05:30", |
| 180 | "2002-12-12 22:30:40-02", |
| 181 | }; |
| 182 | static const char * const duration_string[] = { |
| 183 | "2:34:56.79", |
| 184 | "-1:23:45.67", |
| 185 | "42.1729", |
| 186 | "-1729.42", |
| 187 | "12:34", |
| 188 | "2147483648s", |
| 189 | "4294967296ms", |
| 190 | "8589934592us", |
| 191 | "9223372036854775808us", |
| 192 | }; |
| 193 | |
| 194 | av_log_set_level(AV_LOG_DEBUG); |
| 195 | putenv(tzstr); |
| 196 | printf("(now is 2012-03-17 09:14:13.2 +0100, local time is UTC+1)\n"); |
| 197 | for (i = 0; i < FF_ARRAY_ELEMS(time_string); i++) { |
| 198 | printf("%-24s -> ", time_string[i]); |
| 199 | if (av_parse_time(&tv, time_string[i], 0)) { |
| 200 | printf("error\n"); |
| 201 | } else { |
| 202 | tvi = tv / 1000000; |
| 203 | tm = gmtime(&tvi); |
| 204 | printf("%14"PRIi64".%06d = %04d-%02d-%02dT%02d:%02d:%02dZ\n", |
| 205 | tv / 1000000, (int)(tv % 1000000), |
| 206 | tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, |
| 207 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
| 208 | } |
| 209 | } |
| 210 | for (i = 0; i < FF_ARRAY_ELEMS(duration_string); i++) { |
| 211 | printf("%-24s -> ", duration_string[i]); |
| 212 | if (av_parse_time(&tv, duration_string[i], 1)) { |
| 213 | printf("error\n"); |
| 214 | } else { |
| 215 | printf("%+21"PRIi64"\n", tv); |
| 216 | } |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | static void test_av_get_known_color_name(void) |
| 221 | { |
no test coverage detected