diff --git a/libavutil/timestamp.c b/libavutil/timestamp.c
index 6c231a517d..eab2531538 100644
|
a
|
b
|
char *av_ts_make_time_string2(char *buf, int64_t ts, AVRational tb)
|
| 24 | 24 | snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS"); |
| 25 | 25 | } else { |
| 26 | 26 | double val = av_q2d(tb) * ts; |
| 27 | | double log = (fpclassify(val) == FP_ZERO ? -INFINITY : floor(log10(fabs(val)))); |
| | 27 | double log = (fpclassify(val) == FP_ZERO ? FP_INFINITE : floor(log10(fabs(val)))); |
| 28 | 28 | int precision = (isfinite(log) && log < 0) ? -log + 5 : 6; |
| 29 | 29 | int last = snprintf(buf, AV_TS_MAX_STRING_SIZE, "%.*f", precision, val); |
| 30 | 30 | last = FFMIN(last, AV_TS_MAX_STRING_SIZE - 1) - 1; |