Changeset 6f6b844
- Timestamp:
- Apr 20, 2021, 11:28:42 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- dabc428
- Parents:
- 6c5d92f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/time.hfa
r6c5d92f r6f6b844 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 14 09:30:30202113 // Update Count : 66 412 // Last Modified On : Tue Apr 20 23:25:58 2021 13 // Update Count : 665 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 }; } 31 32 void ?{}( Duration & dur, timeval t ) with( dur ) { tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * 1000; }33 34 Duration ?=?( Duration & dur, timeval t ) with( dur ) { 34 35 tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * (TIMEGRAN / 1_000_000LL); 35 36 return dur; 36 37 } // ?=? 37 38 void ?{}( Duration & dur, timespec t ) with( dur ) { tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; }39 38 Duration ?=?( Duration & dur, timespec t ) with( dur ) { 40 39 tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; … … 61 60 Duration ?%?( Duration lhs, Duration rhs ) { return (Duration)@{ lhs.tn % rhs.tn }; } 62 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; } 63 69 64 70 bool ?==?( Duration lhs, Duration rhs ) { return lhs.tn == rhs.tn; } … … 68 74 bool ?>? ( Duration lhs, Duration rhs ) { return lhs.tn > rhs.tn; } 69 75 bool ?>=?( Duration lhs, Duration rhs ) { return lhs.tn >= rhs.tn; } 70 71 bool ?==?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn == 0; }72 bool ?!=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn != 0; }73 bool ?<? ( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn < 0; }74 bool ?<=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn <= 0; }75 bool ?>? ( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn > 0; }76 bool ?>=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn >= 0; }77 76 78 77 Duration abs( Duration rhs ) { return rhs.tn >= 0 ? rhs : -rhs; } … … 118 117 static inline { 119 118 void ?{}( timeval & t ) {} 119 void ?{}( timeval & t, __attribute__((unused)) zero_t ) { t{ 0, 0 }; } 120 120 void ?{}( timeval & t, time_t sec, suseconds_t usec ) { t.tv_sec = sec; t.tv_usec = usec; } 121 121 void ?{}( timeval & t, time_t sec ) { t{ sec, 0 }; } 122 void ?{}( timeval & t, __attribute__((unused)) zero_t ) { t{ 0, 0 }; }123 122 124 123 timeval ?=?( timeval & t, __attribute__((unused)) zero_t ) { return t{ 0 }; } … … 133 132 static inline { 134 133 void ?{}( timespec & t ) {} 134 void ?{}( timespec & t, __attribute__((unused)) zero_t ) { t{ 0, 0 }; } 135 135 void ?{}( timespec & t, time_t sec, __syscall_slong_t nsec ) { t.tv_sec = sec; t.tv_nsec = nsec; } 136 136 void ?{}( timespec & t, time_t sec ) { t{ sec, 0}; } 137 void ?{}( timespec & t, __attribute__((unused)) zero_t ) { t{ 0, 0 }; }138 137 139 138 timespec ?=?( timespec & t, __attribute__((unused)) zero_t ) { return t{ 0 }; } … … 164 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 ); 165 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 166 168 Time ?=?( Time & time, __attribute__((unused)) zero_t ) { return time{ 0 }; } 167 168 void ?{}( Time & time, timeval t ) with( time ) { tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * 1000; }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; }175 173 Time ?=?( Time & time, timespec t ) with( time ) { 176 174 tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec;
Note: See TracChangeset
for help on using the changeset viewer.