// License: Modified MIT (NON-AI) // See the LICENSE file in the root directory for license information. // Copyright 2025 Timothy Prepscius #pragma once #include "Time.h" #include namespace tjp::core::time { using V = s64; struct Rate { Amount v; static const Amount Zero; } ; struct Duration { V v; static const Duration Zero; } ; constexpr Duration Forever { V(60) * 60 * 24 * 365 * 100 }; constexpr Duration Now { 0 }; struct Time { V v; static const Time Zero; } ; struct Converter { V v; constexpr Duration operator()(Amount a) const { return { V(a * v) }; } } ; constexpr Converter Milliseconds { 1 }; constexpr Converter Centiseconds { 10 }; constexpr Converter Deciseconds { 100 }; constexpr Converter Seconds { 1000 }; constexpr Converter Minutes { 60 * 1000 }; constexpr Converter Hours { 60 * 60 * 1000 }; constexpr Converter Days { 24 * 60 * 60 * 1000 }; constexpr Converter Years { V(365) * 24 * 60 * 60 * 1000 }; constexpr Time FarFuture { std::numeric_limits::max() }; constexpr Time Epoch { 0 }; } #include "Time+operations.hpp"