diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2014-04-28 01:24:35 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2014-04-28 01:24:35 +0000 |
commit | 73dc912a6ae9256feaf6a0c32db535ad31ed658f (patch) | |
tree | bec9bc2a418b7138b83ea96591fd832f7a28dd50 /llvm/lib/Support | |
parent | 0ef74f571ce398924fa63f1ab8c64d0609edee00 (diff) | |
download | bcm5719-llvm-73dc912a6ae9256feaf6a0c32db535ad31ed658f.tar.gz bcm5719-llvm-73dc912a6ae9256feaf6a0c32db535ad31ed658f.zip |
Update the Windows TimeValue formatting to match the new formatting on
Unix-like OSes.
llvm-svn: 207388
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r-- | llvm/lib/Support/Windows/TimeValue.inc | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/llvm/lib/Support/Windows/TimeValue.inc b/llvm/lib/Support/Windows/TimeValue.inc index 6c59024d9c6..166d0d59c1d 100644 --- a/llvm/lib/Support/Windows/TimeValue.inc +++ b/llvm/lib/Support/Windows/TimeValue.inc @@ -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); } |