11 #include "llvm/Config/llvm-config.h" 28 std::time_t OurTime =
toTimeT(TP);
30 #if defined(LLVM_ON_UNIX) 31 struct tm *
LT = ::localtime_r(&OurTime, &Storage);
36 int Error = ::localtime_s(&Storage, &OurTime);
46 char Buffer[
sizeof(
"YYYY-MM-DD HH:MM:SS")];
47 strftime(Buffer,
sizeof(Buffer),
"%Y-%m-%d %H:%M:%S", <);
48 return OS << Buffer <<
'.' 50 long((TP.time_since_epoch() % std::chrono::seconds(1))
56 using namespace std::chrono;
58 auto Fractional = T - Truncated;
61 if (Style.
empty()) Style =
"%Y-%m-%d %H:%M:%S.%N";
64 for (
unsigned I = 0;
I < Style.
size(); ++
I) {
65 if (Style[
I] ==
'%' && Style.
size() >
I + 1)
switch (Style[
I + 1]) {
68 "%.3lu", (
long)duration_cast<milliseconds>(Fractional).
count());
73 "%.6lu", (
long)duration_cast<microseconds>(Fractional).
count());
78 "%.6lu", (
long)duration_cast<nanoseconds>(Fractional).
count());
90 size_t Len = strftime(Buffer,
sizeof(Buffer), Format.c_str(), &
LT);
91 OS << (Len ? Buffer :
"BAD-DATE-FORMAT");
LLVM_ATTRIBUTE_ALWAYS_INLINE std::time_t toTimeT(TimePoint<> TP)
Convert a TimePoint to std::time_t.
This class represents lattice values for constants.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
static struct tm getStructTM(TimePoint<> TP)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
auto count(R &&Range, const E &Element) -> typename std::iterator_traits< decltype(adl_begin(Range))>::difference_type
Wrapper function around std::count to count the number of times an element Element occurs in the give...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
A raw_ostream that writes to an std::string.
Lightweight error class with error context and mandatory checking.
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.
std::chrono::time_point< std::chrono::system_clock, D > TimePoint
A time point on the system clock.