diff --git a/libavformat/utils.c b/libavformat/utils.c index 122fc1fdc4..c6e4627bf3 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -4079,8 +4079,8 @@ int64_t ff_iso8601_to_unix_time(const char *datestr) { struct tm time1 = { 0 }, time2 = { 0 }; char *ret1, *ret2; - ret1 = av_small_strptime(datestr, "%Y - %m - %d %H:%M:%S", &time1); - ret2 = av_small_strptime(datestr, "%Y - %m - %dT%H:%M:%S", &time2); + ret1 = av_small_strptime(datestr, "%Y - %m - %d %T", &time1); + ret2 = av_small_strptime(datestr, "%Y - %m - %dT%T", &time2); if (ret2 && !ret1) return av_timegm(&time2); else diff --git a/libavutil/parseutils.h b/libavutil/parseutils.h index c80f0de3de..e66d24b76e 100644 --- a/libavutil/parseutils.h +++ b/libavutil/parseutils.h @@ -145,32 +145,6 @@ const char *av_get_known_color_name(int color_idx, const uint8_t **rgb); */ int av_parse_time(int64_t *timeval, const char *timestr, int duration); -/** - * Parse the input string p according to the format string fmt and - * store its results in the structure dt. - * This implementation supports only a subset of the formats supported - * by the standard strptime(). - * - * In particular it actually supports the parameters: - * - %H: the hour as a decimal number, using a 24-hour clock, in the - * range '00' through '23' - * - %J: hours as a decimal number, in the range '0' through INT_MAX - * - %M: the minute as a decimal number, using a 24-hour clock, in the - * range '00' through '59' - * - %S: the second as a decimal number, using a 24-hour clock, in the - * range '00' through '59' - * - %Y: the year as a decimal number, using the Gregorian calendar - * - %m: the month as a decimal number, in the range '1' through '12' - * - %d: the day of the month as a decimal number, in the range '1' - * through '31' - * - %%: a literal '%' - * - * @return a pointer to the first character not processed in this - * function call, or NULL in case the function fails to match all of - * the fmt string and therefore an error occurred - */ -char *av_small_strptime(const char *p, const char *fmt, struct tm *dt); - /** * Attempt to find a specific tag in a URL. * @@ -179,6 +153,38 @@ char *av_small_strptime(const char *p, const char *fmt, struct tm *dt); */ int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); +/** + * Simplified version of strptime + * + * Parse the input string p according to the format string fmt and + * store its results in the structure dt. + * This implementation supports only a subset of the formats supported + * by the standard strptime(). + * + * The supported input field descriptors are listed below. + * - %H: the hour as a decimal number, using a 24-hour clock, in the + * range '00' through '23' + * - %J: hours as a decimal number, in the range '0' through INT_MAX + * - %M: the minute as a decimal number, using a 24-hour clock, in the + * range '00' through '59' + * - %S: the second as a decimal number, using a 24-hour clock, in the + * range '00' through '59' + * - %Y: the year as a decimal number, using the Gregorian calendar + * - %m: the month as a decimal number, in the range '1' through '12' + * - %d: the day of the month as a decimal number, in the range '1' + * through '31' + * - %T: alias for '%H:%M:%S' + * - %%: a literal '%' + * + * @return a pointer to the first character not processed in this function + * call. In case the input string contains more characters than + * required by the format string the return value points right after + * the last consumed input character. In case the whole input string + * is consumed the return value points to the null byte at the end of + * the string. On failure NULL is returned. + */ +char *av_small_strptime(const char *p, const char *fmt, struct tm *dt); + /** * Convert the decomposed UTC time in tm to a time_t value. */ diff --git a/libavutil/version.h b/libavutil/version.h index 30be0f0f89..a3d95d8c57 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -57,7 +57,7 @@ #define LIBAVUTIL_VERSION_MAJOR 54 #define LIBAVUTIL_VERSION_MINOR 22 -#define LIBAVUTIL_VERSION_MICRO 100 +#define LIBAVUTIL_VERSION_MICRO 101 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \