OGLplus  (0.59.0) a C++ wrapper for rendering APIs

time.hpp
Go to the documentation of this file.
1 
9 #ifndef EAGINE_UNITS_UNIT_SI_TIME_HPP
10 #define EAGINE_UNITS_UNIT_SI_TIME_HPP
11 
12 #include "common.hpp"
13 
14 namespace eagine::units {
15 namespace base {
16 
17 // second
18 struct second : unit<time, second> {};
19 
20 // minute
21 using minute = scaled_unit<scales::constant<60>, second>;
22 
23 // hour
24 using hour = scaled_unit<scales::constant<3600>, second>;
25 
26 // day
27 using day = scaled_unit<scales::constant<86400>, second>;
28 
29 } // namespace base
30 
31 template <>
32 struct name_of<base::second> {
33  static constexpr const char mp_str[] = "second";
34 };
35 template <>
36 struct symbol_of<base::second> {
37  static constexpr const char mp_str[] = "s";
38 };
39 
40 template <>
41 struct name_of<base::minute> {
42  static constexpr const char mp_str[] = "minute";
43 };
44 template <>
45 struct symbol_of<base::minute> {
46  static constexpr const char mp_str[] = "min";
47 };
48 
49 template <>
50 struct name_of<base::hour> {
51  static constexpr const char mp_str[] = "hour";
52 };
53 template <>
54 struct symbol_of<base::hour> {
55  static constexpr const char mp_str[] = "hr";
56 };
57 
58 template <>
59 struct name_of<base::day> {
60  static constexpr const char mp_str[] = "day";
61 };
62 template <>
63 struct symbol_of<base::day> {
64  static constexpr const char mp_str[] = "D";
65 };
66 
67 // si::base_unit<time>
68 template <>
69 struct si::base_unit<base::time> : base::second {};
70 
71 using second = unit<time, si>;
72 
73 // derived
74 using millisecond =
75  make_scaled_base_dim_unit_t<base::scaled_unit<scales::milli, base::second>, si>;
76 
77 using minute = make_scaled_base_dim_unit_t<base::minute, si>;
78 using hour = make_scaled_base_dim_unit_t<base::hour, si>;
79 using day = make_scaled_base_dim_unit_t<base::day, si>;
80 
81 } // namespace eagine::units
82 
83 #endif // EAGINE_UNITS_UNIT_SI_TIME_HPP

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).