// The MIT License (MIT) // // Copyright (c) 2018 Mateusz Pusz // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #pragma once #include #include namespace units { struct dimension_time : make_dimension_t> {}; template<> struct upcasting_traits> : upcast_to {}; template concept bool Time = Quantity && std::Same; template using time = quantity; struct second : unit {}; template<> struct upcasting_traits> : upcast_to {}; struct nanosecond : nano {}; template<> struct upcasting_traits> : upcast_to {}; struct microsecond : micro {}; template<> struct upcasting_traits> : upcast_to {}; struct millisecond : milli {}; template<> struct upcasting_traits> : upcast_to {}; struct minute : unit> {}; template<> struct upcasting_traits> : upcast_to {}; struct hour : unit> {}; template<> struct upcasting_traits> : upcast_to {}; inline namespace literals { // ns constexpr auto operator""_ns(unsigned long long l) { return time(l); } constexpr auto operator""_ns(long double l) { return time(l); } // us constexpr auto operator""_us(unsigned long long l) { return time(l); } constexpr auto operator""_us(long double l) { return time(l); } // ms constexpr auto operator""_ms(unsigned long long l) { return time(l); } constexpr auto operator""_ms(long double l) { return time(l); } // s constexpr auto operator""_s(unsigned long long l) { return time(l); } constexpr auto operator""_s(long double l) { return time(l); } // min constexpr auto operator""_min(unsigned long long l) { return time(l); } constexpr auto operator""_min(long double l) { return time(l); } // h constexpr auto operator""_h(unsigned long long l) { return time(l); } constexpr auto operator""_h(long double l) { return time(l); } } // namespace literals } // namespace units