Skip to content

Commit d66ee04

Browse files
peffgitster
authored andcommitted
test-date: fix sscanf type conversion
Reading into a time_t isn't portable, since we don't know the exact type. Instead, use an unsigned long, which is what show_date wants, anyway. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b4cf0f1 commit d66ee04

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test-date.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ static void parse_dates(char **argv, struct timeval *now)
2020
{
2121
for (; *argv; argv++) {
2222
char result[100];
23-
time_t t;
23+
unsigned long t;
2424
int tz;
2525

2626
result[0] = 0;
2727
parse_date(*argv, result, sizeof(result));
28-
if (sscanf(result, "%ld %d", &t, &tz) == 2)
28+
if (sscanf(result, "%lu %d", &t, &tz) == 2)
2929
printf("%s -> %s\n",
3030
*argv, show_date(t, tz, DATE_ISO8601));
3131
else

0 commit comments

Comments
 (0)