From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2124) id 9EC993858C5E; Mon, 2 Oct 2023 12:24:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9EC993858C5E Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Nick Clifton To: bfd-cvs@sourceware.org Subject: [binutils-gdb] Use bfd_get_current_time in places where it is suitable X-Act-Checkin: binutils-gdb X-Git-Author: Nick Clifton X-Git-Refname: refs/heads/master X-Git-Oldrev: 8f6f3f29653d8396146bd93a5c63925a13dd047a X-Git-Newrev: 6a6117ab0ffe18ea984abca84869eae799c1b346 Message-Id: <20231002122411.9EC993858C5E@sourceware.org> Date: Mon, 2 Oct 2023 12:24:11 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Oct 2023 12:24:11 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D6a6117ab0ffe= 18ea984abca84869eae799c1b346 commit 6a6117ab0ffe18ea984abca84869eae799c1b346 Author: Nick Clifton Date: Mon Oct 2 13:24:05 2023 +0100 Use bfd_get_current_time in places where it is suitable Diff: --- bfd/ChangeLog | 5 +++++ bfd/peXXigen.c | 12 +----------- ld/ChangeLog | 5 +++++ ld/pe-dll.c | 10 +--------- 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 6c4e3e52953..851b47606c4 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2023-10-02 Nick Clifton + + * peXXigen.c (_bfd_XXi_only_swap_filehdr_out): Use + bfd_get_current_time when filing in the timestamp. + 2023-09-29 Nick Clifton =20 PR 30906 diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c index 2f2968d48e8..641c259d04b 100644 --- a/bfd/peXXigen.c +++ b/bfd/peXXigen.c @@ -839,17 +839,7 @@ _bfd_XXi_only_swap_filehdr_out (bfd * abfd, void * in,= void * out) option was chosen. */ if ((pe_data (abfd)->timestamp) =3D=3D -1) { - time_t now; - char *source_date_epoch; - - /* If the SOURCE_DATE_EPOCH environment variable is - defined then use that as the time, otherwise use - the current time. */ - source_date_epoch =3D getenv ("SOURCE_DATE_EPOCH"); - if (source_date_epoch) - now =3D (time_t) strtoll (source_date_epoch, NULL, 10); - else - now =3D time (NULL); + time_t now =3D bfd_get_current_time (0); H_PUT_32 (abfd, now, filehdr_out->f_timdat); } else diff --git a/ld/ChangeLog b/ld/ChangeLog index 3e41bdc294e..4e4f5326d80 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2023-10-02 Nick Clifton + + * pe-dll.c (fill_edata): Use bfd_get_current_time when filling in + the timestamp. + 2023-09-27 Hsinyuan Xavier =20 PR 30875 diff --git a/ld/pe-dll.c b/ld/pe-dll.c index df08a57e644..fc83f5208d6 100644 --- a/ld/pe-dll.c +++ b/ld/pe-dll.c @@ -1232,15 +1232,7 @@ fill_edata (bfd *abfd, struct bfd_link_info *info AT= TRIBUTE_UNUSED) =20 if (pe_data (abfd)->timestamp =3D=3D -1) { - time_t now; - char *source_date_epoch; - - source_date_epoch =3D getenv ("SOURCE_DATE_EPOCH"); - if (source_date_epoch) - now =3D (time_t) strtoll (source_date_epoch, NULL, 10); - else - now =3D time (NULL); - + time_t now =3D bfd_get_current_time (0); H_PUT_32 (abfd, now, edata_d + 4); } else