1#define CHRONO_UTILITIES_TIMESPAN_INTEGER_SCALE_OVERLOADS
21#if defined(__GLIBCXX__) && _GLIBCXX_RELEASE < 10
29#if defined(_LIBCPP_VERSION) || (defined(__GLIBCXX__) && _GLIBCXX_RELEASE < 11)
32 auto r = std::from_chars_result{
nullptr, std::errc() };
34 auto l =
s.data() +
s.size();
35 auto d = std::strtod(
s.data(), &
l);
37 r.ec = std::errc::result_out_of_range;
38 }
else if (
s.data() ==
l) {
39 r.ec = std::errc::invalid_argument;
80 auto parts = std::array<double, 4>();
84 for (
const char *
i =
str;; ++
i) {
86 if (*
i ==
' ' &&
i ==
str) {
107 if (
res.ec != std::errc()) {
108 const auto part = std::string_view(
str,
static_cast<std::string_view::size_type
>(
i -
str));
109 if (
res.ec == std::errc::result_out_of_range) {
158 }
else if (*
i ==
'\0') {
187 stringstream
s(stringstream::in | stringstream::out);
#define CPP_UTILITIES_UNUSED(x)
Prevents warnings about unused variables.
The ConversionException class is thrown by the various conversion functions of this library when a co...
Represents a time interval.
constexpr bool isNull() const
Returns true if the time interval represented by the current TimeSpan class is null.
static constexpr TickType nanosecondsPerTick
constexpr int seconds() const
Returns the seconds component of the time interval represented by the current TimeSpan class.
constexpr int minutes() const
Returns the minutes component of the time interval represented by the current TimeSpan class.
constexpr TimeSpan()
Constructs a new instance of the TimeSpan class with zero ticks.
constexpr int days() const
Returns the days component of the time interval represented by the current TimeSpan class.
constexpr int milliseconds() const
Returns the milliseconds component of the time interval represented by the current TimeSpan class.
static constexpr TimeSpan fromDays(double days)
Constructs a new instance of the TimeSpan class with the specified number of days.
static constexpr TimeSpan fromHours(double hours)
Constructs a new instance of the TimeSpan class with the specified number of hours.
static constexpr TimeSpan fromMinutes(double minutes)
Constructs a new instance of the TimeSpan class with the specified number of minutes.
static constexpr TimeSpan fromSeconds(double seconds)
Constructs a new instance of the TimeSpan class with the specified number of seconds.
constexpr int microseconds() const
Returns the microseconds component of the time interval represented by the current TimeSpan class.
std::string toString(TimeSpanOutputFormat format=TimeSpanOutputFormat::Normal, bool fullSeconds=false) const
Converts the value of the current TimeSpan object to its equivalent std::string representation accord...
static TimeSpan fromString(const std::string &str, char separator=':')
Parses the given std::string as TimeSpan.
constexpr int hours() const
Returns the hours component of the time interval represented by the current TimeSpan class.
constexpr int nanoseconds() const
Returns the nanoseconds component of the time interval represented by the current TimeSpan class.
Contains all utilities provides by the c++utilities library.
TimeSpanOutputFormat
Specifies the output format.
IntegralType stringToNumber(const StringType &string, BaseType base=10)
Converts the given string to an unsigned/signed number assuming string uses the specified base.
StringType argsToString(Args &&...args)