Changes in libcfa/src/time.hfa [030653a:e638266]
- File:
-
- 1 edited
-
libcfa/src/time.hfa (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/time.hfa
r030653a re638266 10 10 // Created On : Wed Mar 14 23:18:57 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 17 16:13:00 202013 // Update Count : 66 312 // Last Modified On : Wed Apr 21 06:32:31 2021 13 // Update Count : 667 14 14 // 15 15 … … 28 28 29 29 static inline { 30 void ?{}( Duration & dur, timeval t ) with( dur ) { tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * 1000; } 31 void ?{}( Duration & dur, timespec t ) with( dur ) { tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; } 32 30 33 Duration ?=?( Duration & dur, __attribute__((unused)) zero_t ) { return dur{ 0 }; } 34 Duration ?=?( Duration & dur, timeval t ) with( dur ) { 35 tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * (TIMEGRAN / 1_000_000LL); 36 return dur; 37 } // ?=? 38 Duration ?=?( Duration & dur, timespec t ) with( dur ) { 39 tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; 40 return dur; 41 } // ?=? 31 42 32 43 Duration +?( Duration rhs ) with( rhs ) { return (Duration)@{ +tn }; } … … 49 60 Duration ?%?( Duration lhs, Duration rhs ) { return (Duration)@{ lhs.tn % rhs.tn }; } 50 61 Duration ?%=?( Duration & lhs, Duration rhs ) { lhs = lhs % rhs; return lhs; } 62 63 bool ?==?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn == 0; } 64 bool ?!=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn != 0; } 65 bool ?<? ( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn < 0; } 66 bool ?<=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn <= 0; } 67 bool ?>? ( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn > 0; } 68 bool ?>=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn >= 0; } 51 69 52 70 bool ?==?( Duration lhs, Duration rhs ) { return lhs.tn == rhs.tn; } … … 56 74 bool ?>? ( Duration lhs, Duration rhs ) { return lhs.tn > rhs.tn; } 57 75 bool ?>=?( Duration lhs, Duration rhs ) { return lhs.tn >= rhs.tn; } 58 59 bool ?==?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn == 0; }60 bool ?!=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn != 0; }61 bool ?<? ( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn < 0; }62 bool ?<=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn <= 0; }63 bool ?>? ( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn > 0; }64 bool ?>=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn >= 0; }65 76 66 77 Duration abs( Duration rhs ) { return rhs.tn >= 0 ? rhs : -rhs; } … … 152 163 void ?{}( Time & time, int year, int month = 1, int day = 1, int hour = 0, int min = 0, int sec = 0, int64_t nsec = 0 ); 153 164 static inline { 165 void ?{}( Time & time, timeval t ) with( time ) { tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * 1000; } 166 void ?{}( Time & time, timespec t ) with( time ) { tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; } 167 154 168 Time ?=?( Time & time, __attribute__((unused)) zero_t ) { return time{ 0 }; } 155 156 void ?{}( Time & time, timeval t ) with( time ) { tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * 1000; }157 169 Time ?=?( Time & time, timeval t ) with( time ) { 158 170 tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * (TIMEGRAN / 1_000_000LL); 159 171 return time; 160 172 } // ?=? 161 162 void ?{}( Time & time, timespec t ) with( time ) { tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; }163 173 Time ?=?( Time & time, timespec t ) with( time ) { 164 174 tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec;
Note:
See TracChangeset
for help on using the changeset viewer.