[PATCH] D144281: Update output for timestamp with llvm-readobj on XCOFF files.

Stephen Peckham via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 28 07:25:00 PST 2023


stephenpeckham updated this revision to Diff 501128.
stephenpeckham removed rG LLVM Github Monorepo as the repository for this revision.
stephenpeckham added a comment.

This update only backs out the changes except for removing the extra characters.  WIthout a Windows system, the changes to user localtime_r() and update the test case are not practical.  It would be nice to have a common function to print timestamps for all object file formats.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144281/new/

https://reviews.llvm.org/D144281

Files:
  llvm/test/tools/llvm-readobj/XCOFF/file-header.test
  llvm/tools/llvm-readobj/XCOFFDumper.cpp


Index: llvm/tools/llvm-readobj/XCOFFDumper.cpp
===================================================================
--- llvm/tools/llvm-readobj/XCOFFDumper.cpp
+++ llvm/tools/llvm-readobj/XCOFFDumper.cpp
@@ -98,10 +98,11 @@
     // tests will let us know.
     time_t TimeDate = TimeStamp;
 
-    char FormattedTime[21] = {};
-    size_t BytesWritten =
-        strftime(FormattedTime, 21, "%Y-%m-%dT%H:%M:%SZ", gmtime(&TimeDate));
-    if (BytesWritten)
+    char FormattedTime[80] = {};
+
+    size_t BytesFormatted =
+      strftime(FormattedTime, sizeof(FormattedTime), "%F %T", gmtime(&TimeDate));
+    if (BytesFormatted)
       W.printHex("TimeStamp", FormattedTime, TimeStamp);
     else
       W.printHex("Timestamp", TimeStamp);
Index: llvm/test/tools/llvm-readobj/XCOFF/file-header.test
===================================================================
--- llvm/test/tools/llvm-readobj/XCOFF/file-header.test
+++ llvm/test/tools/llvm-readobj/XCOFF/file-header.test
@@ -10,7 +10,7 @@
 # FILEHEADER32-NEXT:FileHeader {
 # FILEHEADER32-NEXT:  Magic: 0x1DF
 # FILEHEADER32-NEXT:  NumberOfSections: 1
-# FILEHEADER32-NEXT:  TimeStamp: 1970-01-01T00:00:01Z (0x1)
+# FILEHEADER32-NEXT:  TimeStamp: 1970-01-01 00:00:01 (0x1)
 # FILEHEADER32-NEXT:  SymbolTableOffset: 0x3C
 # FILEHEADER32-NEXT:  SymbolTableEntries: 1
 # FILEHEADER32-NEXT:  OptionalHeaderSize: 0x0


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144281.501128.patch
Type: text/x-patch
Size: 1368 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230228/fb41428f/attachment.bin>


More information about the llvm-commits mailing list