std::chrono...ration::zero(3)
π NAME π
Hey bestie π welcome to the std::chrono...ration::zero(3) page from the C++ Standard Libary. std::chrono::duration::zero β literally std::chrono::duration::zero. That's the whole name, no notes, just main-character energy π.
π¦ Synopsis π¦
static constexpr duration zero(); (until C++20)
static constexpr duration zero() noexcept; (since C++20)
Returns a zero-length duration β¨.
If the representation rep of the duration requires some other implementation to return a zero-length duration, std::chrono::duration_values can be specialized to return the desired value. Lowkey powerful, ngl π«Ά.
πΈ Parameters πΈ
(none) β literally nobody, bestie π.
π Return value π
Returns duration(std::chrono::duration_values<rep>::zero()). Periodt π.
π₯ Example π₯
This is the code, bestie β run it and watch the zeroes line up:
// Run this code
#include <chrono>
#include <ratio>
template<typename X, typename Y>
using dura = std::chrono::duration<X, Y>;
static_assert
(
(std::chrono::hours::zero() == std::chrono::nanoseconds::zero()) &&
(dura<short, std::nano>::zero() == dura<int, std::deci>::zero()) &&
(dura<short, std::deca>::zero() == dura<long, std::exa>::zero()) &&
(dura<long, std::atto>::zero().count() == dura<float, std::exa>::zero().count())
);
int main() {}
The static_assert is doing the absolute most, and it ate π₯.
π See also π
minβ returns the special duration valuemin;[static](public static member function) πmaxβ returns the special duration valuemax;[static](public static member function) π
Source/version + date: http://cppreference.com, 2024.06.10. Bye bestie β go return zero and serve absolutely nothing (duration-wise) π
β¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms