mirror of
https://github.com/ETLCPP/etl.git
synced 2026-11-09 14:49:53 +08:00
Added floating point duration types
This commit is contained in:
parent
279ce8f0dc
commit
39f17a94b8
@ -628,6 +628,14 @@ namespace etl
|
||||
return etl::chrono::hours(static_cast<etl::chrono::hours::rep>(h));
|
||||
}
|
||||
|
||||
//***********************************************************************
|
||||
/// Literal for floating point hours duration
|
||||
//***********************************************************************
|
||||
inline ETL_CONSTEXPR etl::chrono::duration<double, ratio<3600>> operator""_h(long double h) noexcept
|
||||
{
|
||||
return etl::chrono::duration<double, ratio<3600>>(h);
|
||||
}
|
||||
|
||||
//***********************************************************************
|
||||
/// Literal for minutes duration
|
||||
//***********************************************************************
|
||||
@ -636,6 +644,14 @@ namespace etl
|
||||
return etl::chrono::minutes(static_cast<etl::chrono::minutes::rep>(m));
|
||||
}
|
||||
|
||||
//***********************************************************************
|
||||
/// Literal for floating point minutes duration
|
||||
//***********************************************************************
|
||||
inline ETL_CONSTEXPR etl::chrono::duration<double, ratio<60>> operator ""_minutes(long double m) noexcept
|
||||
{
|
||||
return etl::chrono::duration<double, ratio<60>>(m);
|
||||
}
|
||||
|
||||
//***********************************************************************
|
||||
/// Literal for seconds duration
|
||||
//***********************************************************************
|
||||
@ -644,6 +660,14 @@ namespace etl
|
||||
return etl::chrono::seconds(static_cast<etl::chrono::seconds::rep>(s));
|
||||
}
|
||||
|
||||
//***********************************************************************
|
||||
/// Literal for floating point seconds duration
|
||||
//***********************************************************************
|
||||
inline ETL_CONSTEXPR etl::chrono::duration<double> operator ""_seconds(long double s) noexcept
|
||||
{
|
||||
return etl::chrono::duration<double>(s);
|
||||
}
|
||||
|
||||
//***********************************************************************
|
||||
/// Literal for milliseconds duration
|
||||
//***********************************************************************
|
||||
@ -652,6 +676,14 @@ namespace etl
|
||||
return etl::chrono::milliseconds(static_cast<etl::chrono::milliseconds::rep>(s));
|
||||
}
|
||||
|
||||
//***********************************************************************
|
||||
/// Literal for floating point milliseconds duration
|
||||
//***********************************************************************
|
||||
inline ETL_CONSTEXPR etl::chrono::duration<double, milli> operator ""_milliseconds(long double s) noexcept
|
||||
{
|
||||
return etl::chrono::duration<double, milli>(s);
|
||||
}
|
||||
|
||||
//***********************************************************************
|
||||
/// Literal for microseconds duration
|
||||
//***********************************************************************
|
||||
@ -660,6 +692,14 @@ namespace etl
|
||||
return etl::chrono::microseconds(static_cast<etl::chrono::microseconds::rep>(s));
|
||||
}
|
||||
|
||||
//***********************************************************************
|
||||
/// Literal for floating point microseconds duration
|
||||
//***********************************************************************
|
||||
inline ETL_CONSTEXPR etl::chrono::duration<double, micro> operator ""_microseconds(long double s) noexcept
|
||||
{
|
||||
return etl::chrono::duration<double, micro>(s);
|
||||
}
|
||||
|
||||
//***********************************************************************
|
||||
/// Literal for nanoseconds duration
|
||||
//***********************************************************************
|
||||
@ -667,6 +707,14 @@ namespace etl
|
||||
{
|
||||
return etl::chrono::nanoseconds(static_cast<etl::chrono::nanoseconds::rep>(s));
|
||||
}
|
||||
|
||||
//***********************************************************************
|
||||
/// Literal for floating point microseconds duration
|
||||
//***********************************************************************
|
||||
inline ETL_CONSTEXPR etl::chrono::duration<double, nano> operator ""_nanoseconds(long double s) noexcept
|
||||
{
|
||||
return etl::chrono::duration<double, nano>(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user