1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // <chrono> 11 12 // duration 13 14 // template <class Rep1, class Period, class Rep2> 15 // constexpr 16 // duration<typename common_type<Rep1, Rep2>::type, Period> 17 // operator%(const duration<Rep1, Period>& d, const Rep2& s) 18 19 #include <chrono> 20 #include <cassert> 21 22 int main() 23 { 24 { 25 std::chrono::nanoseconds ns(15); 26 ns = ns % 6; 27 assert(ns.count() == 3); 28 } 29 #ifndef _LIBCPP_HAS_NO_CONSTEXPR 30 { 31 constexpr std::chrono::nanoseconds ns(15); 32 constexpr std::chrono::nanoseconds ns2 = ns % 6; 33 static_assert(ns2.count() == 3, ""); 34 } 35 #endif 36 } 37