brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 1 | #ifndef AOS_COMMON_TIME_H_ |
| 2 | #define AOS_COMMON_TIME_H_ |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | #include <time.h> |
brians | 57dd582 | 2013-02-27 21:44:15 +0000 | [diff] [blame] | 6 | #include <sys/time.h> |
Brian | 4a424a2 | 2014-04-02 11:52:45 -0700 | [diff] [blame] | 7 | #include <stdint.h> |
| 8 | |
| 9 | #include <type_traits> |
Austin Schuh | 793d6b9 | 2016-05-01 13:28:14 -0700 | [diff] [blame] | 10 | #include <chrono> |
| 11 | #include <thread> |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 12 | #include <ostream> |
| 13 | |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 14 | #include "aos/common/type_traits.h" |
Brian Silverman | b407c67 | 2014-04-09 11:58:37 -0700 | [diff] [blame] | 15 | #include "aos/common/macros.h" |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 16 | |
| 17 | namespace aos { |
Austin Schuh | 793d6b9 | 2016-05-01 13:28:14 -0700 | [diff] [blame] | 18 | |
| 19 | class monotonic_clock { |
| 20 | public: |
| 21 | typedef ::std::chrono::nanoseconds::rep rep; |
| 22 | typedef ::std::chrono::nanoseconds::period period; |
| 23 | typedef ::std::chrono::nanoseconds duration; |
| 24 | typedef ::std::chrono::time_point<monotonic_clock> time_point; |
| 25 | |
| 26 | static monotonic_clock::time_point now() noexcept; |
| 27 | static constexpr bool is_steady = true; |
| 28 | |
| 29 | // Returns the epoch (0). |
| 30 | static constexpr monotonic_clock::time_point epoch() { |
Austin Schuh | 8aec1ed | 2016-05-01 13:29:20 -0700 | [diff] [blame] | 31 | return time_point(zero()); |
Austin Schuh | 793d6b9 | 2016-05-01 13:28:14 -0700 | [diff] [blame] | 32 | } |
Austin Schuh | 8aec1ed | 2016-05-01 13:29:20 -0700 | [diff] [blame] | 33 | |
| 34 | static constexpr monotonic_clock::duration zero() { return duration(0); } |
Austin Schuh | 858c021 | 2016-11-25 17:23:30 -0800 | [diff] [blame] | 35 | |
| 36 | static constexpr time_point min_time{ |
| 37 | time_point(duration(::std::numeric_limits<duration::rep>::min()))}; |
Austin Schuh | 793d6b9 | 2016-05-01 13:28:14 -0700 | [diff] [blame] | 38 | }; |
| 39 | |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 40 | namespace time { |
| 41 | |
| 42 | // A nice structure for representing times. |
| 43 | // 0 <= nsec_ < kNSecInSec should always be true. All functions here will make |
| 44 | // sure that that is true if it was on all inputs (including *this). |
| 45 | // |
Brian Silverman | 6659bc3 | 2013-10-16 10:31:32 -0700 | [diff] [blame] | 46 | // Negative times are supported so that all of the normal arithmetic identities |
| 47 | // work. nsec_ is still always positive. |
| 48 | // |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 49 | // The arithmetic and comparison operators are overloaded because they make |
| 50 | // complete sense and are very useful. The default copy and assignment stuff is |
Brian Silverman | 6659bc3 | 2013-10-16 10:31:32 -0700 | [diff] [blame] | 51 | // left because it works fine. Multiplication of Times by Times is |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 52 | // not implemented because I can't think of any uses for them and there are |
Brian Silverman | 6659bc3 | 2013-10-16 10:31:32 -0700 | [diff] [blame] | 53 | // multiple ways to do it. Division of Times by Times is implemented as the |
| 54 | // ratio of them. Multiplication, division, and modulus of Times by integers are |
Brian Silverman | 0534df6 | 2014-05-26 21:19:15 -0700 | [diff] [blame] | 55 | // implemented as interpreting the argument as nanoseconds. Modulus takes the |
| 56 | // sign from the first operand. |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 57 | struct Time { |
Brian Silverman | 52aeeac | 2013-08-28 16:20:53 -0700 | [diff] [blame] | 58 | #ifdef SWIG |
| 59 | // All of the uses of constexpr here can safely be simply removed. |
| 60 | // NOTE: This means that relying on the fact that constexpr implicitly makes |
Brian Silverman | 6659bc3 | 2013-10-16 10:31:32 -0700 | [diff] [blame] | 61 | // member functions const is not valid, so they all have to be explicitly marked |
| 62 | // const. |
Brian Silverman | 52aeeac | 2013-08-28 16:20:53 -0700 | [diff] [blame] | 63 | #define constexpr |
| 64 | #endif // SWIG |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 65 | public: |
| 66 | static const int32_t kNSecInSec = 1000000000; |
| 67 | static const int32_t kNSecInMSec = 1000000; |
| 68 | static const int32_t kNSecInUSec = 1000; |
| 69 | static const int32_t kMSecInSec = 1000; |
| 70 | static const int32_t kUSecInSec = 1000000; |
Brian Silverman | dcaa3f7 | 2015-11-29 05:32:08 +0000 | [diff] [blame] | 71 | |
| 72 | static const Time kZero; |
| 73 | |
Brian Silverman | 92c3f1e | 2015-12-08 20:21:31 -0500 | [diff] [blame] | 74 | explicit constexpr Time(int32_t sec = 0, int32_t nsec = 0) |
Brian Silverman | 52aeeac | 2013-08-28 16:20:53 -0700 | [diff] [blame] | 75 | : sec_(sec), nsec_(CheckConstexpr(nsec)) { |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 76 | } |
| 77 | #ifndef SWIG |
Brian Silverman | 52aeeac | 2013-08-28 16:20:53 -0700 | [diff] [blame] | 78 | explicit constexpr Time(const struct timespec &value) |
| 79 | : sec_(value.tv_sec), nsec_(CheckConstexpr(value.tv_nsec)) { |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 80 | } |
| 81 | struct timespec ToTimespec() const { |
| 82 | struct timespec ans; |
| 83 | ans.tv_sec = sec_; |
| 84 | ans.tv_nsec = nsec_; |
| 85 | return ans; |
| 86 | } |
Brian Silverman | 52aeeac | 2013-08-28 16:20:53 -0700 | [diff] [blame] | 87 | explicit constexpr Time(const struct timeval &value) |
| 88 | : sec_(value.tv_sec), nsec_(CheckConstexpr(value.tv_usec * kNSecInUSec)) { |
brians | 57dd582 | 2013-02-27 21:44:15 +0000 | [diff] [blame] | 89 | } |
| 90 | struct timeval ToTimeval() const { |
| 91 | struct timeval ans; |
| 92 | ans.tv_sec = sec_; |
| 93 | ans.tv_usec = nsec_ / kNSecInUSec; |
| 94 | return ans; |
| 95 | } |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 96 | #endif // SWIG |
Brian Silverman | 3204dd8 | 2013-03-12 18:42:01 -0700 | [diff] [blame] | 97 | |
Brian Silverman | 14fd0fb | 2014-01-14 21:42:01 -0800 | [diff] [blame] | 98 | // CLOCK_MONOTONIC on linux and CLOCK_REALTIME on the cRIO because the |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 99 | // cRIO doesn't have any others. |
| 100 | // CLOCK_REALTIME is the default realtime clock and CLOCK_MONOTONIC doesn't |
| 101 | // change when somebody changes the wall clock (like the ntp deamon or |
| 102 | // whatever). See clock_gettime(2) for details. |
| 103 | // |
| 104 | // This is the clock that code that just wants to sleep for a certain amount |
| 105 | // of time or measure how long something takes should use. |
| 106 | #ifndef __VXWORKS__ |
| 107 | static const clockid_t kDefaultClock = CLOCK_MONOTONIC; |
| 108 | #else |
| 109 | static const clockid_t kDefaultClock = CLOCK_REALTIME; |
| 110 | #endif |
| 111 | // Creates a Time representing the current value of the specified clock or |
| 112 | // dies. |
| 113 | static Time Now(clockid_t clock = kDefaultClock); |
| 114 | |
| 115 | // Constructs a Time representing seconds. |
Brian Silverman | 52aeeac | 2013-08-28 16:20:53 -0700 | [diff] [blame] | 116 | static constexpr Time InSeconds(double seconds) { |
| 117 | return (seconds < 0.0) ? |
| 118 | Time(static_cast<int32_t>(seconds) - 1, |
| 119 | (seconds - static_cast<int32_t>(seconds) + 1.0) * kNSecInSec) : |
| 120 | Time(static_cast<int32_t>(seconds), |
| 121 | (seconds - static_cast<int32_t>(seconds)) * kNSecInSec); |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 122 | } |
| 123 | |
| 124 | // Constructs a time representing microseconds. |
Brian Silverman | 52aeeac | 2013-08-28 16:20:53 -0700 | [diff] [blame] | 125 | static constexpr Time InNS(int64_t nseconds) { |
Brian Silverman | dcaa3f7 | 2015-11-29 05:32:08 +0000 | [diff] [blame] | 126 | return (nseconds < 0) |
| 127 | ? Time((nseconds - 1) / static_cast<int64_t>(kNSecInSec) - 1, |
| 128 | (((nseconds - 1) % kNSecInSec) + 1) + kNSecInSec) |
| 129 | : Time(nseconds / static_cast<int64_t>(kNSecInSec), |
| 130 | nseconds % kNSecInSec); |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 131 | } |
| 132 | |
| 133 | // Constructs a time representing microseconds. |
Brian Silverman | 52aeeac | 2013-08-28 16:20:53 -0700 | [diff] [blame] | 134 | static constexpr Time InUS(int useconds) { |
Brian Silverman | dcaa3f7 | 2015-11-29 05:32:08 +0000 | [diff] [blame] | 135 | return (useconds < 0) |
| 136 | ? Time((useconds + 1) / kUSecInSec - 1, |
| 137 | (((useconds + 1) % kUSecInSec) - 1) * kNSecInUSec + |
| 138 | kNSecInSec) |
| 139 | : Time(useconds / kUSecInSec, |
| 140 | (useconds % kUSecInSec) * kNSecInUSec); |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | // Constructs a time representing mseconds. |
Brian Silverman | 52aeeac | 2013-08-28 16:20:53 -0700 | [diff] [blame] | 144 | static constexpr Time InMS(int mseconds) { |
Brian Silverman | dcaa3f7 | 2015-11-29 05:32:08 +0000 | [diff] [blame] | 145 | return (mseconds < 0) |
| 146 | ? Time((mseconds + 1) / kMSecInSec - 1, |
| 147 | (((mseconds + 1) % kMSecInSec) - 1) * kNSecInMSec + |
| 148 | kNSecInSec) |
| 149 | : Time(mseconds / kMSecInSec, |
| 150 | (mseconds % kMSecInSec) * kNSecInMSec); |
| 151 | } |
| 152 | |
| 153 | // Construct a time representing the period of hertz. |
Austin Schuh | 8aec1ed | 2016-05-01 13:29:20 -0700 | [diff] [blame] | 154 | static constexpr ::std::chrono::nanoseconds FromRate(int hertz) { |
| 155 | return ::std::chrono::duration_cast<::std::chrono::nanoseconds>( |
| 156 | ::std::chrono::seconds(1)) / |
| 157 | hertz; |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 158 | } |
| 159 | |
| 160 | // Checks whether or not this time is within amount nanoseconds of other. |
| 161 | bool IsWithin(const Time &other, int64_t amount) const; |
| 162 | |
| 163 | // Returns the time represented all in nanoseconds. |
Brian Silverman | 52aeeac | 2013-08-28 16:20:53 -0700 | [diff] [blame] | 164 | int64_t constexpr ToNSec() const { |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 165 | return static_cast<int64_t>(sec_) * static_cast<int64_t>(kNSecInSec) + |
| 166 | static_cast<int64_t>(nsec_); |
| 167 | } |
| 168 | #ifdef __VXWORKS__ |
| 169 | // Returns the time represented all in system clock ticks. The system clock |
| 170 | // rate is retrieved using sysClkRateGet(). |
| 171 | int ToTicks() const { |
| 172 | return ToNSec() / static_cast<int64_t>(kNSecInSec / sysClkRateGet()); |
| 173 | } |
Brian Silverman | 3204dd8 | 2013-03-12 18:42:01 -0700 | [diff] [blame] | 174 | // Constructs a Time representing ticks. |
| 175 | static Time InTicks(int ticks) { |
Brian Silverman | ffe3d71 | 2013-03-15 21:35:59 -0700 | [diff] [blame] | 176 | return Time::InSeconds(static_cast<double>(ticks) / sysClkRateGet()); |
Brian Silverman | 3204dd8 | 2013-03-12 18:42:01 -0700 | [diff] [blame] | 177 | } |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 178 | #endif |
| 179 | |
| 180 | // Returns the time represented in milliseconds. |
Brian Silverman | 52aeeac | 2013-08-28 16:20:53 -0700 | [diff] [blame] | 181 | int64_t constexpr ToMSec() const { |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 182 | return static_cast<int64_t>(sec_) * static_cast<int64_t>(kMSecInSec) + |
| 183 | (static_cast<int64_t>(nsec_) / static_cast<int64_t>(kNSecInMSec)); |
| 184 | } |
| 185 | |
Brian Silverman | 7645d2f | 2013-03-30 18:53:56 -0700 | [diff] [blame] | 186 | // Returns the time represent in microseconds. |
Brian Silverman | 52aeeac | 2013-08-28 16:20:53 -0700 | [diff] [blame] | 187 | int64_t constexpr ToUSec() const { |
Brian Silverman | 7645d2f | 2013-03-30 18:53:56 -0700 | [diff] [blame] | 188 | return static_cast<int64_t>(sec_) * static_cast<int64_t>(kUSecInSec) + |
| 189 | (static_cast<int64_t>(nsec_) / static_cast<int64_t>(kNSecInUSec)); |
| 190 | } |
| 191 | |
brians | f0165ca | 2013-03-02 06:17:47 +0000 | [diff] [blame] | 192 | // Returns the time represented in fractional seconds. |
Brian Silverman | 52aeeac | 2013-08-28 16:20:53 -0700 | [diff] [blame] | 193 | double constexpr ToSeconds() const { |
brians | f0165ca | 2013-03-02 06:17:47 +0000 | [diff] [blame] | 194 | return static_cast<double>(sec_) + static_cast<double>(nsec_) / kNSecInSec; |
| 195 | } |
| 196 | |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 197 | #ifndef SWIG |
| 198 | Time &operator+=(const Time &rhs); |
| 199 | Time &operator-=(const Time &rhs); |
| 200 | Time &operator*=(int32_t rhs); |
| 201 | Time &operator/=(int32_t rhs); |
| 202 | Time &operator%=(int32_t rhs); |
Brian Silverman | 0079a9d | 2013-10-24 15:57:35 -0700 | [diff] [blame] | 203 | Time &operator%=(double rhs) = delete; |
| 204 | Time &operator*=(double rhs) = delete; |
| 205 | Time &operator/=(double rhs) = delete; |
| 206 | const Time operator*(double rhs) const = delete; |
| 207 | const Time operator/(double rhs) const = delete; |
| 208 | const Time operator%(double rhs) const = delete; |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 209 | #endif |
| 210 | const Time operator+(const Time &rhs) const; |
| 211 | const Time operator-(const Time &rhs) const; |
| 212 | const Time operator*(int32_t rhs) const; |
| 213 | const Time operator/(int32_t rhs) const; |
Brian Silverman | 2e0dcfd | 2013-03-30 22:44:40 -0700 | [diff] [blame] | 214 | double operator/(const Time &rhs) const; |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 215 | const Time operator%(int32_t rhs) const; |
| 216 | |
Brian Silverman | 0079a9d | 2013-10-24 15:57:35 -0700 | [diff] [blame] | 217 | const Time operator-() const; |
| 218 | |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 219 | bool operator==(const Time &rhs) const; |
| 220 | bool operator!=(const Time &rhs) const; |
| 221 | bool operator<(const Time &rhs) const; |
| 222 | bool operator>(const Time &rhs) const; |
| 223 | bool operator<=(const Time &rhs) const; |
| 224 | bool operator>=(const Time &rhs) const; |
| 225 | |
| 226 | #ifndef SWIG |
| 227 | // For gtest etc. |
| 228 | friend std::ostream &operator<<(std::ostream &os, const Time &time); |
| 229 | #endif // SWIG |
| 230 | |
Brian Silverman | 52aeeac | 2013-08-28 16:20:53 -0700 | [diff] [blame] | 231 | int32_t constexpr sec() const { return sec_; } |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 232 | void set_sec(int32_t sec) { sec_ = sec; } |
Brian Silverman | 52aeeac | 2013-08-28 16:20:53 -0700 | [diff] [blame] | 233 | int32_t constexpr nsec() const { return nsec_; } |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 234 | void set_nsec(int32_t nsec) { |
| 235 | nsec_ = nsec; |
| 236 | Check(); |
| 237 | } |
| 238 | |
Brian Silverman | 3204dd8 | 2013-03-12 18:42:01 -0700 | [diff] [blame] | 239 | // Absolute value. |
| 240 | Time abs() const { |
| 241 | if (*this > Time(0, 0)) return *this; |
Brian Silverman | f3cbebd | 2013-03-19 16:53:18 -0700 | [diff] [blame] | 242 | if (nsec_ == 0) return Time(-sec_, 0); |
Brian Silverman | 3204dd8 | 2013-03-12 18:42:01 -0700 | [diff] [blame] | 243 | return Time(-sec_ - 1, kNSecInSec - nsec_); |
| 244 | } |
| 245 | |
| 246 | // Enables returning the mock time value for Now instead of checking the |
Brian Silverman | 6da0427 | 2014-05-18 18:47:48 -0700 | [diff] [blame] | 247 | // system clock. |
Brian Silverman | b407c67 | 2014-04-09 11:58:37 -0700 | [diff] [blame] | 248 | static void EnableMockTime(const Time &now = Now()); |
| 249 | // Calls SetMockTime with the current actual time. |
| 250 | static void UpdateMockTime(); |
Brian Silverman | 3204dd8 | 2013-03-12 18:42:01 -0700 | [diff] [blame] | 251 | // Sets now when time is being mocked. |
Brian Silverman | 6659bc3 | 2013-10-16 10:31:32 -0700 | [diff] [blame] | 252 | static void SetMockTime(const Time &now); |
| 253 | // Convenience function to just increment the mock time by a certain amount in |
| 254 | // a thread safe way. |
| 255 | static void IncrementMockTime(const Time &amount); |
Brian Silverman | 3204dd8 | 2013-03-12 18:42:01 -0700 | [diff] [blame] | 256 | // Disables mocking time. |
| 257 | static void DisableMockTime(); |
| 258 | |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 259 | private: |
| 260 | int32_t sec_, nsec_; |
Brian Silverman | 52aeeac | 2013-08-28 16:20:53 -0700 | [diff] [blame] | 261 | |
| 262 | // LOG(FATAL)s if nsec is >= kNSecInSec or negative. |
| 263 | static void CheckImpl(int32_t nsec); |
| 264 | void Check() { CheckImpl(nsec_); } |
| 265 | // A constexpr version of CheckImpl that returns the given value when it |
Brian Silverman | 6659bc3 | 2013-10-16 10:31:32 -0700 | [diff] [blame] | 266 | // succeeds or evaluates to non-constexpr and returns 0 when it fails. |
| 267 | // This will result in the usual LOG(FATAL) if this is used where it isn't |
| 268 | // required to be constexpr or a compile error if it is. |
Brian Silverman | 52aeeac | 2013-08-28 16:20:53 -0700 | [diff] [blame] | 269 | static constexpr int32_t CheckConstexpr(int32_t nsec) { |
| 270 | return (nsec >= kNSecInSec || nsec < 0) ? CheckImpl(nsec), 0 : nsec; |
| 271 | } |
| 272 | |
| 273 | #ifdef SWIG |
| 274 | #undef constexpr |
| 275 | #endif // SWIG |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 276 | }; |
| 277 | |
| 278 | // Sleeps for the amount of time represented by time counted by clock. |
| 279 | void SleepFor(const Time &time, clockid_t clock = Time::kDefaultClock); |
| 280 | // Sleeps until clock is at the time represented by time. |
| 281 | void SleepUntil(const Time &time, clockid_t clock = Time::kDefaultClock); |
| 282 | |
Brian Silverman | d057569 | 2015-02-21 16:24:02 -0500 | [diff] [blame] | 283 | // Sets the global offset for all times so ::aos::time::Time::Now() will return |
| 284 | // now. |
| 285 | // There is no synchronization here, so this is only safe when only a single |
| 286 | // task is running. |
| 287 | // This is only allowed when the shared memory core infrastructure has been |
| 288 | // initialized in this process. |
| 289 | void OffsetToNow(const Time &now); |
| 290 | |
Brian Silverman | b407c67 | 2014-04-09 11:58:37 -0700 | [diff] [blame] | 291 | // RAII class that freezes Time::Now() (to avoid making large numbers of |
| 292 | // syscalls to find the real time). |
| 293 | class TimeFreezer { |
| 294 | public: |
| 295 | TimeFreezer() { |
| 296 | Time::EnableMockTime(); |
| 297 | } |
| 298 | ~TimeFreezer() { |
| 299 | Time::DisableMockTime(); |
| 300 | } |
| 301 | |
| 302 | private: |
| 303 | DISALLOW_COPY_AND_ASSIGN(TimeFreezer); |
| 304 | }; |
| 305 | |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 306 | } // namespace time |
| 307 | } // namespace aos |
| 308 | |
Austin Schuh | 793d6b9 | 2016-05-01 13:28:14 -0700 | [diff] [blame] | 309 | namespace std { |
| 310 | namespace this_thread { |
| 311 | // Template specialization for monotonic_clock, since we can use clock_nanosleep |
| 312 | // with TIMER_ABSTIME and get very precise absolute time sleeps. |
| 313 | template <> |
| 314 | void sleep_until(const ::aos::monotonic_clock::time_point &end_time); |
| 315 | |
| 316 | } // namespace this_thread |
| 317 | } // namespace std |
| 318 | |
| 319 | |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 320 | #endif // AOS_COMMON_TIME_H_ |