summaryrefslogtreecommitdiffhomepage
path: root/src/timer-ns.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-03-02 16:00:48 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-03-04 06:58:03 +0100
commit06c0defb8b63ba7cdb43ed674beb1cd97847479e (patch)
tree333b171d46566c8005f0c2d056ffe0a876257626 /src/timer-ns.cpp
parent167c59e2d363ddf609c4e1b6190cb43eeef24637 (diff)
a?
Diffstat (limited to 'src/timer-ns.cpp')
-rw-r--r--src/timer-ns.cpp71
1 files changed, 2 insertions, 69 deletions
diff --git a/src/timer-ns.cpp b/src/timer-ns.cpp
index a705365e..5bc302ff 100644
--- a/src/timer-ns.cpp
+++ b/src/timer-ns.cpp
@@ -26,73 +26,6 @@ static_assert(MAX - HALF <= HALF+1);
} // namespace
-Ns operator+(const Ns& lhs, const Ns& rhs)
-{
- constexpr auto max = (uint64_t)-1;
- auto a = lhs.stamp, b = rhs.stamp;
- fm_assert(max - a >= b);
- return Ns{a + b};
-}
-
-Ns operator-(const Ns& lhs, const Ns& rhs)
-{
- auto a = lhs.stamp, b = rhs.stamp;
- fm_assert(a >= b);
- return Ns{a - b};
-}
-
-uint64_t operator/(const Ns& lhs, const Ns& rhs)
-{
- auto a = lhs.stamp, b = rhs.stamp;
- fm_assert(b != 0);
- return a / b;
-}
-
-Ns operator/(const Ns& lhs, uint64_t b)
-{
- auto a = lhs.stamp;
- fm_assert(b != 0);
- return Ns{a / b};
-}
-
-uint64_t operator%(const Ns& lhs, const Ns& rhs)
-{
- auto a = lhs.stamp, b = rhs.stamp;
- fm_assert(b != 0);
- return a % b;
-}
-
-Ns operator%(const Ns& lhs, uint64_t b)
-{
- auto a = lhs.stamp;
- fm_assert(b != 0);
- return Ns{a % b};
-}
-
-bool operator==(const Ns& lhs, const Ns& rhs)
-{
- auto a = lhs.stamp, b = rhs.stamp;
- return a == b;
-}
-
-std::strong_ordering operator<=>(const Ns& lhs, const Ns& rhs)
-{
- auto a = lhs.stamp, b = rhs.stamp;
- return a <=> b;
-}
-
-Ns Ns::from_millis(uint64_t a)
-{
- constexpr auto b = uint64_t(1e6);
- const auto x = a * b;
- fm_assert(a == 0 || x / a == b);
- return Ns{x};
-};
-
-Ns::operator uint64_t() const { return stamp; }
-Ns::operator float() const { return float(stamp); }
-uint64_t Ns::operator*() const { return stamp; }
-
Debug& operator<<(Debug& dbg, const Ns& box)
{
const auto value = (float)((double)box.stamp * 1e-6);
@@ -109,10 +42,10 @@ Debug& operator<<(Debug& dbg, const Ns& box)
auto flags = dbg.flags();
dbg << "";
dbg.setFlags(flags | Debug::Flag::NoSpace);
- dbg << "{";
+ //dbg << "{";
dbg << fraction(value, precision);
dbg << " ms";
- dbg << "}";
+ //dbg << "}";
dbg.setFlags(flags);
return dbg;
}