Changes in libcfa/src/time.hfa [e638266:89c2a77b]
- File:
-
- 1 edited
-
libcfa/src/time.hfa (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/time.hfa
re638266 r89c2a77b 10 10 // Created On : Wed Mar 14 23:18:57 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Apr 21 06:32:31202113 // Update Count : 66 712 // Last Modified On : Wed Apr 14 09:30:30 2021 13 // Update Count : 664 14 14 // 15 15 … … 28 28 29 29 static inline { 30 Duration ?=?( Duration & dur, __attribute__((unused)) zero_t ) { return dur{ 0 }; } 31 30 32 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 33 Duration ?=?( Duration & dur, __attribute__((unused)) zero_t ) { return dur{ 0 }; }34 33 Duration ?=?( Duration & dur, timeval t ) with( dur ) { 35 34 tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * (TIMEGRAN / 1_000_000LL); 36 35 return dur; 37 36 } // ?=? 37 38 void ?{}( Duration & dur, timespec t ) with( dur ) { tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; } 38 39 Duration ?=?( Duration & dur, timespec t ) with( dur ) { 39 40 tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; … … 60 61 Duration ?%?( Duration lhs, Duration rhs ) { return (Duration)@{ lhs.tn % rhs.tn }; } 61 62 Duration ?%=?( Duration & lhs, Duration rhs ) { lhs = lhs % rhs; return lhs; } 63 64 bool ?==?( Duration lhs, Duration rhs ) { return lhs.tn == rhs.tn; } 65 bool ?!=?( Duration lhs, Duration rhs ) { return lhs.tn != rhs.tn; } 66 bool ?<? ( Duration lhs, Duration rhs ) { return lhs.tn < rhs.tn; } 67 bool ?<=?( Duration lhs, Duration rhs ) { return lhs.tn <= rhs.tn; } 68 bool ?>? ( Duration lhs, Duration rhs ) { return lhs.tn > rhs.tn; } 69 bool ?>=?( Duration lhs, Duration rhs ) { return lhs.tn >= rhs.tn; } 62 70 63 71 bool ?==?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn == 0; } … … 67 75 bool ?>? ( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn > 0; } 68 76 bool ?>=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn >= 0; } 69 70 bool ?==?( Duration lhs, Duration rhs ) { return lhs.tn == rhs.tn; }71 bool ?!=?( Duration lhs, Duration rhs ) { return lhs.tn != rhs.tn; }72 bool ?<? ( Duration lhs, Duration rhs ) { return lhs.tn < rhs.tn; }73 bool ?<=?( Duration lhs, Duration rhs ) { return lhs.tn <= rhs.tn; }74 bool ?>? ( Duration lhs, Duration rhs ) { return lhs.tn > rhs.tn; }75 bool ?>=?( Duration lhs, Duration rhs ) { return lhs.tn >= rhs.tn; }76 77 77 78 Duration abs( Duration rhs ) { return rhs.tn >= 0 ? rhs : -rhs; } … … 163 164 void ?{}( Time & time, int year, int month = 1, int day = 1, int hour = 0, int min = 0, int sec = 0, int64_t nsec = 0 ); 164 165 static inline { 166 Time ?=?( Time & time, __attribute__((unused)) zero_t ) { return time{ 0 }; } 167 165 168 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 168 Time ?=?( Time & time, __attribute__((unused)) zero_t ) { return time{ 0 }; }169 169 Time ?=?( Time & time, timeval t ) with( time ) { 170 170 tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * (TIMEGRAN / 1_000_000LL); 171 171 return time; 172 172 } // ?=? 173 174 void ?{}( Time & time, timespec t ) with( time ) { tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; } 173 175 Time ?=?( Time & time, timespec t ) with( time ) { 174 176 tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec;
Note:
See TracChangeset
for help on using the changeset viewer.