Windows/TimeValue.inc: Mute prefixed '0' on %d to emulate %e.
authorNAKAMURA Takumi <geek4civic@gmail.com>
Fri, 12 Jul 2013 02:13:03 +0000 (02:13 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Fri, 12 Jul 2013 02:13:03 +0000 (02:13 +0000)
It fixes compatibility in llvm/test/Object/archive-toc.test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186142 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/Windows/TimeValue.inc

index 485022929b21ed4809642a3558da51491a727b17..96f55797e536da3647b2f3dd2c2dff2cee569c4b 100644 (file)
@@ -49,6 +49,11 @@ std::string TimeValue::str() const {
   char Buffer[25];
   // FIXME: the windows version of strftime doesn't support %e
   strftime(Buffer, 25, "%b %d %H:%M %Y", LT);
+  assert((Buffer[3] == ' ' && isdigit(Buffer[5]) && Buffer[6] == ' ') ||
+         "Unexpected format in strftime()!");
+  // Emulate %e on %d to mute '0'.
+  if (Buffer[4] == '0')
+    Buffer[4] = ' ';
   return std::string(Buffer);
 }