mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-26 13:49:56 +00:00
[Support][Chrono] Use explicit cast of text output of time values.
rL316419 exposed a platform specific issue where the type of the values passed to llvm::format could be different to the format string. Debian unstable for mips uses long long int for std::chrono:duration, while x86_64 uses long int. For mips, this resulted in the value being corrupted when rendered to a string. Address this by explicitly casting the result of the duration_cast to the type specified in the format string. Reviewers: sammccall Differential Revision: https://reviews.llvm.org/D39597 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317523 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
790be31f8c
commit
b67df9f5a0
@ -65,17 +65,17 @@ void format_provider<TimePoint<>>::format(const TimePoint<> &T, raw_ostream &OS,
|
||||
if (Style[I] == '%' && Style.size() > I + 1) switch (Style[I + 1]) {
|
||||
case 'L': // Milliseconds, from Ruby.
|
||||
FStream << llvm::format(
|
||||
"%.3lu", duration_cast<milliseconds>(Fractional).count());
|
||||
"%.3lu", (long)duration_cast<milliseconds>(Fractional).count());
|
||||
++I;
|
||||
continue;
|
||||
case 'f': // Microseconds, from Python.
|
||||
FStream << llvm::format(
|
||||
"%.6lu", duration_cast<microseconds>(Fractional).count());
|
||||
"%.6lu", (long)duration_cast<microseconds>(Fractional).count());
|
||||
++I;
|
||||
continue;
|
||||
case 'N': // Nanoseconds, from date(1).
|
||||
FStream << llvm::format(
|
||||
"%.6lu", duration_cast<nanoseconds>(Fractional).count());
|
||||
"%.6lu", (long)duration_cast<nanoseconds>(Fractional).count());
|
||||
++I;
|
||||
continue;
|
||||
case '%': // Consume %%, so %%f parses as (%%)f not %(%f)
|
||||
|
Loading…
x
Reference in New Issue
Block a user