Changes in libcfa/src/time.hfa [73abe95:461eed2]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/time.hfa
r73abe95 r461eed2 10 10 // Created On : Wed Mar 14 23:18:57 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jul 2 21:28:38201813 // Update Count : 64 112 // Last Modified On : Sat Sep 22 12:25:34 2018 13 // Update Count : 643 14 14 // 15 15 … … 23 23 #include <sys/time.h> // timeval 24 24 } 25 #include <time_t.hfa> 25 #include <time_t.hfa> // Duration/Time types 26 26 27 27 enum { TIMEGRAN = 1_000_000_000LL }; // nanosecond granularity, except for timeval … … 52 52 Duration ?%=?( Duration & lhs, Duration rhs ) { lhs = lhs % rhs; return lhs; } 53 53 54 _Bool ?==?( Duration lhs, Duration rhs ) { return lhs.tv == rhs.tv; }55 _Bool ?!=?( Duration lhs, Duration rhs ) { return lhs.tv != rhs.tv; }56 _Bool ?<? ( Duration lhs, Duration rhs ) { return lhs.tv < rhs.tv; }57 _Bool ?<=?( Duration lhs, Duration rhs ) { return lhs.tv <= rhs.tv; }58 _Bool ?>? ( Duration lhs, Duration rhs ) { return lhs.tv > rhs.tv; }59 _Bool ?>=?( Duration lhs, Duration rhs ) { return lhs.tv >= rhs.tv; }60 61 _Bool ?==?( Duration lhs, zero_t ) { return lhs.tv == 0; }62 _Bool ?!=?( Duration lhs, zero_t ) { return lhs.tv != 0; }63 _Bool ?<? ( Duration lhs, zero_t ) { return lhs.tv < 0; }64 _Bool ?<=?( Duration lhs, zero_t ) { return lhs.tv <= 0; }65 _Bool ?>? ( Duration lhs, zero_t ) { return lhs.tv > 0; }66 _Bool ?>=?( Duration lhs, zero_t ) { return lhs.tv >= 0; }54 bool ?==?( Duration lhs, Duration rhs ) { return lhs.tv == rhs.tv; } 55 bool ?!=?( Duration lhs, Duration rhs ) { return lhs.tv != rhs.tv; } 56 bool ?<? ( Duration lhs, Duration rhs ) { return lhs.tv < rhs.tv; } 57 bool ?<=?( Duration lhs, Duration rhs ) { return lhs.tv <= rhs.tv; } 58 bool ?>? ( Duration lhs, Duration rhs ) { return lhs.tv > rhs.tv; } 59 bool ?>=?( Duration lhs, Duration rhs ) { return lhs.tv >= rhs.tv; } 60 61 bool ?==?( Duration lhs, zero_t ) { return lhs.tv == 0; } 62 bool ?!=?( Duration lhs, zero_t ) { return lhs.tv != 0; } 63 bool ?<? ( Duration lhs, zero_t ) { return lhs.tv < 0; } 64 bool ?<=?( Duration lhs, zero_t ) { return lhs.tv <= 0; } 65 bool ?>? ( Duration lhs, zero_t ) { return lhs.tv > 0; } 66 bool ?>=?( Duration lhs, zero_t ) { return lhs.tv >= 0; } 67 67 68 68 Duration abs( Duration rhs ) { return rhs.tv >= 0 ? rhs : -rhs; } … … 104 104 105 105 timeval ?=?( timeval & t, zero_t ) { return t{ 0 }; } 106 timeval ?+?( timeval &lhs, timeval rhs ) { return (timeval)@{ lhs.tv_sec + rhs.tv_sec, lhs.tv_usec + rhs.tv_usec }; }107 timeval ?-?( timeval &lhs, timeval rhs ) { return (timeval)@{ lhs.tv_sec - rhs.tv_sec, lhs.tv_usec - rhs.tv_usec }; }108 _Bool ?==?( timeval lhs, timeval rhs ) { return lhs.tv_sec == rhs.tv_sec && lhs.tv_usec == rhs.tv_usec; }109 _Bool ?!=?( timeval lhs, timeval rhs ) { return lhs.tv_sec != rhs.tv_sec || lhs.tv_usec != rhs.tv_usec; }106 timeval ?+?( timeval lhs, timeval rhs ) { return (timeval)@{ lhs.tv_sec + rhs.tv_sec, lhs.tv_usec + rhs.tv_usec }; } 107 timeval ?-?( timeval lhs, timeval rhs ) { return (timeval)@{ lhs.tv_sec - rhs.tv_sec, lhs.tv_usec - rhs.tv_usec }; } 108 bool ?==?( timeval lhs, timeval rhs ) { return lhs.tv_sec == rhs.tv_sec && lhs.tv_usec == rhs.tv_usec; } 109 bool ?!=?( timeval lhs, timeval rhs ) { return lhs.tv_sec != rhs.tv_sec || lhs.tv_usec != rhs.tv_usec; } 110 110 } // distribution 111 111 … … 119 119 120 120 timespec ?=?( timespec & t, zero_t ) { return t{ 0 }; } 121 timespec ?+?( timespec &lhs, timespec rhs ) { return (timespec)@{ lhs.tv_sec + rhs.tv_sec, lhs.tv_nsec + rhs.tv_nsec }; }122 timespec ?-?( timespec &lhs, timespec rhs ) { return (timespec)@{ lhs.tv_sec - rhs.tv_sec, lhs.tv_nsec - rhs.tv_nsec }; }123 _Bool ?==?( timespec lhs, timespec rhs ) { return lhs.tv_sec == rhs.tv_sec && lhs.tv_nsec == rhs.tv_nsec; }124 _Bool ?!=?( timespec lhs, timespec rhs ) { return lhs.tv_sec != rhs.tv_sec || lhs.tv_nsec != rhs.tv_nsec; }121 timespec ?+?( timespec lhs, timespec rhs ) { return (timespec)@{ lhs.tv_sec + rhs.tv_sec, lhs.tv_nsec + rhs.tv_nsec }; } 122 timespec ?-?( timespec lhs, timespec rhs ) { return (timespec)@{ lhs.tv_sec - rhs.tv_sec, lhs.tv_nsec - rhs.tv_nsec }; } 123 bool ?==?( timespec lhs, timespec rhs ) { return lhs.tv_sec == rhs.tv_sec && lhs.tv_nsec == rhs.tv_nsec; } 124 bool ?!=?( timespec lhs, timespec rhs ) { return lhs.tv_sec != rhs.tv_sec || lhs.tv_nsec != rhs.tv_nsec; } 125 125 } // distribution 126 126 … … 166 166 Time ?-?( Time lhs, Duration rhs ) { return (Time)@{ lhs.tv - rhs.tv }; } 167 167 Time ?-=?( Time & lhs, Duration rhs ) { lhs = lhs - rhs; return lhs; } 168 _Bool ?==?( Time lhs, Time rhs ) { return lhs.tv == rhs.tv; }169 _Bool ?!=?( Time lhs, Time rhs ) { return lhs.tv != rhs.tv; }170 _Bool ?<?( Time lhs, Time rhs ) { return lhs.tv < rhs.tv; }171 _Bool ?<=?( Time lhs, Time rhs ) { return lhs.tv <= rhs.tv; }172 _Bool ?>?( Time lhs, Time rhs ) { return lhs.tv > rhs.tv; }173 _Bool ?>=?( Time lhs, Time rhs ) { return lhs.tv >= rhs.tv; }168 bool ?==?( Time lhs, Time rhs ) { return lhs.tv == rhs.tv; } 169 bool ?!=?( Time lhs, Time rhs ) { return lhs.tv != rhs.tv; } 170 bool ?<?( Time lhs, Time rhs ) { return lhs.tv < rhs.tv; } 171 bool ?<=?( Time lhs, Time rhs ) { return lhs.tv <= rhs.tv; } 172 bool ?>?( Time lhs, Time rhs ) { return lhs.tv > rhs.tv; } 173 bool ?>=?( Time lhs, Time rhs ) { return lhs.tv >= rhs.tv; } 174 174 } // distribution 175 175
Note: See TracChangeset
for help on using the changeset viewer.