strmbase: Fix printing negative values in debugstr_time().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
feature/deterministic
Zebediah Figura 2020-01-30 19:05:16 -06:00 committed by Alexandre Julliard
parent 7c9595ef17
commit f8a63ffda4
1 changed files with 6 additions and 4 deletions

View File

@ -34,15 +34,17 @@
static inline const char *debugstr_time(REFERENCE_TIME time) static inline const char *debugstr_time(REFERENCE_TIME time)
{ {
ULONGLONG abstime = time >= 0 ? time : -time;
unsigned int i = 0, j = 0; unsigned int i = 0, j = 0;
char buffer[22], rev[22]; char buffer[23], rev[23];
while (time || i <= 8) while (abstime || i <= 8)
{ {
buffer[i++] = '0' + (time % 10); buffer[i++] = '0' + (abstime % 10);
time /= 10; abstime /= 10;
if (i == 7) buffer[i++] = '.'; if (i == 7) buffer[i++] = '.';
} }
if (time < 0) buffer[i++] = '-';
while (i--) rev[j++] = buffer[i]; while (i--) rev[j++] = buffer[i];
rev[j] = 0; rev[j] = 0;