[PATCH] D52940: [llvm-ar] Use POSIX-specified timestamps for 'tv'.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 5 14:53:28 PDT 2018


MaskRay accepted this revision.
MaskRay added inline comments.
This revision is now accepted and ready to land.


================
Comment at: tools/llvm-ar/llvm-ar.cpp:375
+    sys::TimePoint<> ModTimeInNs = ModTimeOrErr.get();
+    outs() << ' ' << formatv("{0:%b %e %H:%M %Y}", ModTimeInNs);
     outs() << ' ';
----------------
LG.

The format specifier is what FreeBSD ar uses.

 http://src.illumos.org/source/xref/freebsd-head/usr.bin/ar/read.c#145

An interesting finding is that GNU ar (`binutils-gdb/binutils/bucomm.c`) uses `ctime` in a horrible way:

	  const char *ctime_result = (const char *) ctime (&when);
	  bfd_size_type size;

	  /* PR binutils/17605: Check for corrupt time values.  */
	  if (ctime_result == NULL)
	    sprintf (timebuf, _("<time data corrupt>"));
	  else
	    /* POSIX format:  skip weekday and seconds from ctime output.  */
	    sprintf (timebuf, "%.12s %.4s", ctime_result + 4, ctime_result + 20);



Repository:
  rL LLVM

https://reviews.llvm.org/D52940





More information about the llvm-commits mailing list