From: Nick Clifton Date: Mon, 10 Apr 2000 18:01:16 +0000 (+0000) Subject: Replace 'strftime' with 'sprintf' X-Git-Tag: binutils-2_10~63 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=30583f5f872c8523270b16fdbf4129bb58fcb335;p=thirdparty%2Fbinutils-gdb.git Replace 'strftime' with 'sprintf' --- diff --git a/binutils/ChangeLog b/binutils/ChangeLog index a067bc02a14..f2e5ee481a3 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,9 @@ +2000-04-10 Philippe De Muyter + + * readelf (dynamic_segment_mips_val): Call `sprintf', not + `strftime' since strftime is not available on all systems. + (process_mips_specific): Ditto. + 2000-04-06 Alan Modra * addr2line.c: Update copyright. diff --git a/binutils/readelf.c b/binutils/readelf.c index 050ef9c386e..81d768ea58f 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -2822,8 +2822,13 @@ dynamic_segment_mips_val (entry) case DT_MIPS_TIME_STAMP: { char timebuf[20]; + struct tm * tmp; + time_t time = entry->d_un.d_val; - strftime (timebuf, 20, "%Y-%m-%dT%H:%M:%S", gmtime (&time)); + tmp = gmtime (&time); + sprintf (timebuf, "%04u-%02u-%02uT%02u:%02u:%02u", + tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, + tmp->tm_hour, tmp->tm_min, tmp->tm_sec); printf ("Time Stamp: %s\n", timebuf); } break; @@ -6629,6 +6634,7 @@ process_mips_specific (file) Elf32_Lib liblist; time_t time; char timebuf[20]; + struct tm * tmp; liblist.l_name = BYTE_GET (elib[cnt].l_name); time = BYTE_GET (elib[cnt].l_time_stamp); @@ -6636,7 +6642,10 @@ process_mips_specific (file) liblist.l_version = BYTE_GET (elib[cnt].l_version); liblist.l_flags = BYTE_GET (elib[cnt].l_flags); - strftime (timebuf, 20, "%Y-%m-%dT%H:%M:%S", gmtime (&time)); + tmp = gmtime (&time); + sprintf (timebuf, "%04u-%02u-%02uT%02u:%02u:%02u", + tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, + tmp->tm_hour, tmp->tm_min, tmp->tm_sec); printf ("%3lu: %-20s %s %#10lx %-7ld", (unsigned long) cnt, dynamic_strings + liblist.l_name, timebuf,