LLVM 19.0.0git
Static Public Member Functions | List of all members
llvm::format_provider< std::chrono::duration< Rep, Period > > Struct Template Reference

Implementation of format_provider<T> for duration types. More...

#include "llvm/Support/Chrono.h"

Static Public Member Functions

static void format (const Dur &D, llvm::raw_ostream &Stream, StringRef Style)
 

Detailed Description

template<typename Rep, typename Period>
struct llvm::format_provider< std::chrono::duration< Rep, Period > >

Implementation of format_provider<T> for duration types.

The options string of a duration type has the grammar:

duration_options ::= [unit][show_unit [number_options]] unit ::= h|m|s|ms|us|ns show_unit ::=+|-` number_options ::= options string for a integral or floating point type

Examples

| options | Input | Output |

| "" | 1s | 1 s | | "ms" | 1s | 1000 ms | | "ms-" | 1s | 1000 | | "ms-n" | 1s | 1,000 |

| "" | 1.0s | 1.00 s |

If the unit of the duration type is not one of the units specified above, it is still possible to format it, provided you explicitly request a display unit or you request that the unit is not displayed.

Definition at line 139 of file Chrono.h.

Member Function Documentation

◆ format()

template<typename Rep , typename Period >
static void llvm::format_provider< std::chrono::duration< Rep, Period > >::format ( const Dur &  D,
llvm::raw_ostream Stream,
StringRef  Style 
)
inlinestatic

Definition at line 181 of file Chrono.h.

References assert(), llvm::count(), D, and llvm::StringRef::empty().


The documentation for this struct was generated from the following file: