mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-04 20:54:28 +02:00
day unit added
This commit is contained in:
@@ -33,7 +33,8 @@ struct nanosecond : prefixed_unit<nanosecond, nano, second> {};
|
||||
struct microsecond : prefixed_unit<microsecond, micro, second> {};
|
||||
struct millisecond : prefixed_unit<millisecond, milli, second> {};
|
||||
struct minute : named_scaled_unit<minute, "min", no_prefix, ratio<60>, second> {};
|
||||
struct hour : named_scaled_unit<hour, "h", no_prefix, ratio<3600>, second> {};
|
||||
struct hour : named_scaled_unit<hour, "h", no_prefix, ratio<60>, minute> {};
|
||||
struct day : named_scaled_unit<hour, "d", no_prefix, ratio<24>, hour> {};
|
||||
|
||||
struct dim_time : physical::dim_time<second> {};
|
||||
|
||||
@@ -66,6 +67,10 @@ constexpr auto operator""min(long double l) { return time<minute, long double>(l
|
||||
constexpr auto operator""h(unsigned long long l) { return time<hour, std::int64_t>(l); }
|
||||
constexpr auto operator""h(long double l) { return time<hour, long double>(l); }
|
||||
|
||||
// d
|
||||
constexpr auto operator""_d(unsigned long long l) { return time<day, std::int64_t>(l); }
|
||||
constexpr auto operator""_d(long double l) { return time<day, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace units::si
|
||||
|
@@ -75,7 +75,10 @@ static_assert(1us == 1000ns);
|
||||
static_assert(1ms == 1000us);
|
||||
static_assert(1s == 1000ms);
|
||||
static_assert(1min == 60s);
|
||||
static_assert(1h == 60min);
|
||||
static_assert(1h == 3600s);
|
||||
static_assert(1_d == 24h);
|
||||
static_assert(1_d == 86'400s);
|
||||
|
||||
static_assert(nanosecond::symbol == "ns");
|
||||
static_assert(microsecond::symbol == "µs");
|
||||
|
Reference in New Issue
Block a user