[llvm] r207388 - Update the Windows TimeValue formatting to match the new formatting on
Chandler Carruth
chandlerc at gmail.com
Sun Apr 27 18:24:35 PDT 2014
Author: chandlerc
Date: Sun Apr 27 20:24:35 2014
New Revision: 207388
URL: http://llvm.org/viewvc/llvm-project?rev=207388&view=rev
Log:
Update the Windows TimeValue formatting to match the new formatting on
Unix-like OSes.
Modified:
llvm/trunk/lib/Support/Windows/TimeValue.inc
Modified: llvm/trunk/lib/Support/Windows/TimeValue.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/TimeValue.inc?rev=207388&r1=207387&r2=207388&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/TimeValue.inc (original)
+++ llvm/trunk/lib/Support/Windows/TimeValue.inc Sun Apr 27 20:24:35 2014
@@ -47,13 +47,9 @@ std::string TimeValue::str() const {
LT = &Storage;
#endif
- 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);
+ char Buffer1[sizeof("YYYY-MM-DD HH:MM:SS")];
+ strftime(Buffer1, sizeof(Buffer1), "%Y-%m-%d %H:%M:%S", LT);
+ char Buffer2[sizeof("YYYY-MM-DD HH:MM:SS.MMMUUUNNN")];
+ snprintf(Buffer2, sizeof(Buffer2), "%s.%.9u", Buffer1, this->nanoseconds());
+ return std::string(Buffer2);
}
More information about the llvm-commits
mailing list