Changeset e0c235c for libcfa/src
- Timestamp:
- Jan 5, 2020, 9:31:00 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 4834563
- Parents:
- 3c67255
- Location:
- libcfa/src
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/alarm.cfa
r3c67255 re0c235c 10 10 // Created On : Fri Jun 2 11:31:25 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 3 22:47:24 201913 // Update Count : 6 812 // Last Modified On : Sun Jan 5 08:41:36 2020 13 // Update Count : 69 14 14 // 15 15 … … 39 39 40 40 void __kernel_set_timer( Duration alarm ) { 41 verifyf(alarm >= 1`us || alarm == 0, "Setting timer to < 1us (%jins)", alarm .tv);41 verifyf(alarm >= 1`us || alarm == 0, "Setting timer to < 1us (%jins)", alarm`ns); 42 42 setitimer( ITIMER_REAL, &(itimerval){ alarm }, 0p ); 43 43 } -
libcfa/src/time.cfa
r3c67255 re0c235c 10 10 // Created On : Tue Mar 27 13:33:14 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S at Jul 13 08:41:55 201913 // Update Count : 6 512 // Last Modified On : Sun Jan 5 17:27:40 2020 13 // Update Count : 69 14 14 // 15 15 … … 33 33 forall( dtype ostype | ostream( ostype ) ) { 34 34 ostype & ?|?( ostype & os, Duration dur ) with( dur ) { 35 (ostype &)(os | t v/ TIMEGRAN); // print seconds36 long int ns = (t v < 0 ? -tv : tv) % TIMEGRAN; // compute nanoseconds35 (ostype &)(os | tn / TIMEGRAN); // print seconds 36 long int ns = (tn < 0 ? -tn : tn) % TIMEGRAN; // compute nanoseconds 37 37 if ( ns != 0 ) { // some ? 38 38 char buf[16]; … … 52 52 53 53 #ifdef __CFA_DEBUG__ 54 static void tabort( int year, int month, int day, int hour, int min, int sec, int nsec ) {54 static void tabort( int year, int month, int day, int hour, int min, int sec, int64_t nsec ) { 55 55 abort | "Attempt to create Time( year=" | year | "(>=1970), month=" | month | "(1-12), day=" | day | "(1-31), hour=" | hour | "(0-23), min=" | min | "(0-59), sec=" | sec 56 | "(0-60), nsec=" | nsec | "(0-999_999_999), which exceeds range 00:00:00 UTC, January 1, 1970 to 03:14:07 UTC, January 19, 2038.";56 | "(0-60), nsec=" | nsec | "(0-999_999_999), which is not in the range 00:00:00 UTC, January 1, 1970 to 03:14:07 UTC, January 19, 2038, where month and day have 1 origin."; 57 57 } // tabort 58 58 #endif // __CFA_DEBUG__ 59 59 60 void ?{}( Time & time, int year, int month, int day, int hour, int min, int sec, int nsec ) with( time ) {60 void ?{}( Time & time, int year, int month, int day, int hour, int min, int sec, int64_t nsec ) with( time ) { 61 61 tm tm; 62 62 63 tm.tm_isdst = -1; // let mktime determine if alternate timezone is in effect63 // Values can be in any range (+/-) but result must be in the epoch. 64 64 tm.tm_year = year - 1900; // mktime uses 1900 as its starting point 65 #ifdef __CFA_DEBUG__ 66 if ( month < 1 || 12 < month ) { 67 tabort( year, month, day, hour, min, sec, nsec ); 68 } // if 69 #endif // __CFA_DEBUG__ 65 // Make month in range 1-12 to match with day. 70 66 tm.tm_mon = month - 1; // mktime uses range 0-11 71 #ifdef __CFA_DEBUG__72 if ( day < 1 || 31 < day ) {73 tabort( year, month, day, hour, min, sec, nsec );74 } // if75 #endif // __CFA_DEBUG__76 67 tm.tm_mday = day; // mktime uses range 1-31 77 68 tm.tm_hour = hour; 78 69 tm.tm_min = min; 79 70 tm.tm_sec = sec; 71 tm.tm_isdst = -1; // let mktime determine if alternate timezone is in effect 80 72 time_t epochsec = mktime( &tm ); 81 73 #ifdef __CFA_DEBUG__ 82 if ( epochsec == (time_t)-1 ) {74 if ( epochsec <= (time_t)-1 ) { // MUST BE LESS THAN OR EQUAL! 83 75 tabort( year, month, day, hour, min, sec, nsec ); 84 76 } // if 85 77 #endif // __CFA_DEBUG__ 86 t v= (int64_t)(epochsec) * TIMEGRAN + nsec; // convert to nanoseconds78 tn = (int64_t)(epochsec) * TIMEGRAN + nsec; // convert to nanoseconds 87 79 #ifdef __CFA_DEBUG__ 88 if ( t v> 2147483647LL * TIMEGRAN ) { // between 00:00:00 UTC, January 1, 1970 and 03:14:07 UTC, January 19, 2038.80 if ( tn > 2147483647LL * TIMEGRAN ) { // between 00:00:00 UTC, January 1, 1970 and 03:14:07 UTC, January 19, 2038. 89 81 tabort( year, month, day, hour, min, sec, nsec ); 90 82 } // if … … 93 85 94 86 char * yy_mm_dd( Time time, char * buf ) with( time ) { 95 time_t s = t v/ TIMEGRAN;87 time_t s = tn / TIMEGRAN; 96 88 tm tm; 97 89 gmtime_r( &s, &tm ); // tm_mon <= 11, tm_mday <= 31 … … 108 100 109 101 char * mm_dd_yy( Time time, char * buf ) with( time ) { 110 time_t s = t v/ TIMEGRAN;102 time_t s = tn / TIMEGRAN; 111 103 tm tm; 112 104 gmtime_r( &s, &tm ); // tm_mon <= 11, tm_mday <= 31 … … 123 115 124 116 char * dd_mm_yy( Time time, char * buf ) with( time ) { 125 time_t s = t v/ TIMEGRAN;117 time_t s = tn / TIMEGRAN; 126 118 tm tm; 127 119 gmtime_r( &s, &tm ); // tm_mon <= 11, tm_mday <= 31 … … 138 130 139 131 size_t strftime( char * buf, size_t size, const char * fmt, Time time ) with( time ) { 140 time_t s = t v/ TIMEGRAN;132 time_t s = tn / TIMEGRAN; 141 133 tm tm; 142 134 gmtime_r( &s, &tm ); … … 147 139 ostype & ?|?( ostype & os, Time time ) with( time ) { 148 140 char buf[32]; // at least 26 149 time_t s = t v/ TIMEGRAN;141 time_t s = tn / TIMEGRAN; 150 142 ctime_r( &s, (char *)&buf ); // 26 characters: "Wed Jun 30 21:49:08 1993\n" 151 143 buf[24] = '\0'; // remove trailing '\n' 152 long int ns = (t v < 0 ? -tv : tv) % TIMEGRAN; // compute nanoseconds144 long int ns = (tn < 0 ? -tn : tn) % TIMEGRAN; // compute nanoseconds 153 145 if ( ns == 0 ) { // none ? 154 146 (ostype &)(os | buf); // print date/time/year -
libcfa/src/time.hfa
r3c67255 re0c235c 10 10 // Created On : Wed Mar 14 23:18:57 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S at Sep 22 12:25:34 201813 // Update Count : 6 4312 // Last Modified On : Sun Jan 5 19:01:07 2020 13 // Update Count : 652 14 14 // 15 15 … … 32 32 Duration ?=?( Duration & dur, __attribute__((unused)) zero_t ) { return dur{ 0 }; } 33 33 34 Duration +?( Duration rhs ) with( rhs ) { return (Duration)@{ +tv}; }35 Duration ?+?( Duration & lhs, Duration rhs ) { return (Duration)@{ lhs.t v + rhs.tv}; }34 Duration +?( Duration rhs ) with( rhs ) { return (Duration)@{ +tn }; } 35 Duration ?+?( Duration & lhs, Duration rhs ) { return (Duration)@{ lhs.tn + rhs.tn }; } 36 36 Duration ?+=?( Duration & lhs, Duration rhs ) { lhs = lhs + rhs; return lhs; } 37 37 38 Duration -?( Duration rhs ) with( rhs ) { return (Duration)@{ -t v}; }39 Duration ?-?( Duration & lhs, Duration rhs ) { return (Duration)@{ lhs.t v - rhs.tv}; }38 Duration -?( Duration rhs ) with( rhs ) { return (Duration)@{ -tn }; } 39 Duration ?-?( Duration & lhs, Duration rhs ) { return (Duration)@{ lhs.tn - rhs.tn }; } 40 40 Duration ?-=?( Duration & lhs, Duration rhs ) { lhs = lhs - rhs; return lhs; } 41 41 42 Duration ?*?( Duration lhs, int64_t rhs ) { return (Duration)@{ lhs.t v* rhs }; }43 Duration ?*?( int64_t lhs, Duration rhs ) { return (Duration)@{ lhs * rhs.t v}; }42 Duration ?*?( Duration lhs, int64_t rhs ) { return (Duration)@{ lhs.tn * rhs }; } 43 Duration ?*?( int64_t lhs, Duration rhs ) { return (Duration)@{ lhs * rhs.tn }; } 44 44 Duration ?*=?( Duration & lhs, int64_t rhs ) { lhs = lhs * rhs; return lhs; } 45 45 46 int64_t ?/?( Duration lhs, Duration rhs ) { return lhs.t v / rhs.tv; }47 Duration ?/?( Duration lhs, int64_t rhs ) { return (Duration)@{ lhs.t v/ rhs }; }46 int64_t ?/?( Duration lhs, Duration rhs ) { return lhs.tn / rhs.tn; } 47 Duration ?/?( Duration lhs, int64_t rhs ) { return (Duration)@{ lhs.tn / rhs }; } 48 48 Duration ?/=?( Duration & lhs, int64_t rhs ) { lhs = lhs / rhs; return lhs; } 49 double div( Duration lhs, Duration rhs ) { return (double)lhs.t v / (double)rhs.tv; }50 51 Duration ?%?( Duration lhs, Duration rhs ) { return (Duration)@{ lhs.t v % rhs.tv}; }49 double div( Duration lhs, Duration rhs ) { return (double)lhs.tn / (double)rhs.tn; } 50 51 Duration ?%?( Duration lhs, Duration rhs ) { return (Duration)@{ lhs.tn % rhs.tn }; } 52 52 Duration ?%=?( Duration & lhs, Duration rhs ) { lhs = lhs % rhs; return lhs; } 53 53 54 bool ?==?( Duration lhs, Duration rhs ) { return lhs.t v == rhs.tv; }55 bool ?!=?( Duration lhs, Duration rhs ) { return lhs.t v != rhs.tv; }56 bool ?<? ( Duration lhs, Duration rhs ) { return lhs.t v < rhs.tv; }57 bool ?<=?( Duration lhs, Duration rhs ) { return lhs.t v <= rhs.tv; }58 bool ?>? ( Duration lhs, Duration rhs ) { return lhs.t v > rhs.tv; }59 bool ?>=?( Duration lhs, Duration rhs ) { return lhs.t v >= rhs.tv; }60 61 bool ?==?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.t v== 0; }62 bool ?!=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.t v!= 0; }63 bool ?<? ( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.t v< 0; }64 bool ?<=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.t v<= 0; }65 bool ?>? ( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.t v> 0; }66 bool ?>=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.t v>= 0; }67 68 Duration abs( Duration rhs ) { return rhs.t v>= 0 ? rhs : -rhs; }54 bool ?==?( Duration lhs, Duration rhs ) { return lhs.tn == rhs.tn; } 55 bool ?!=?( Duration lhs, Duration rhs ) { return lhs.tn != rhs.tn; } 56 bool ?<? ( Duration lhs, Duration rhs ) { return lhs.tn < rhs.tn; } 57 bool ?<=?( Duration lhs, Duration rhs ) { return lhs.tn <= rhs.tn; } 58 bool ?>? ( Duration lhs, Duration rhs ) { return lhs.tn > rhs.tn; } 59 bool ?>=?( Duration lhs, Duration rhs ) { return lhs.tn >= rhs.tn; } 60 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 bool ?>? ( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn > 0; } 66 bool ?>=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn >= 0; } 67 68 Duration abs( Duration rhs ) { return rhs.tn >= 0 ? rhs : -rhs; } 69 69 70 70 Duration ?`ns( int64_t nsec ) { return (Duration)@{ nsec }; } … … 82 82 Duration ?`w( double weeks ) { return (Duration)@{ weeks * (7LL * 24LL * 60LL * 60LL * TIMEGRAN) }; } 83 83 84 int64_t ?`ns( Duration dur ) { return dur.t v; }85 int64_t ?`us( Duration dur ) { return dur.t v/ (TIMEGRAN / 1_000_000LL); }86 int64_t ?`ms( Duration dur ) { return dur.t v/ (TIMEGRAN / 1_000LL); }87 int64_t ?`s( Duration dur ) { return dur.t v/ TIMEGRAN; }88 int64_t ?`m( Duration dur ) { return dur.t v/ (60LL * TIMEGRAN); }89 int64_t ?`h( Duration dur ) { return dur.t v/ (60LL * 60LL * TIMEGRAN); }90 int64_t ?`d( Duration dur ) { return dur.t v/ (24LL * 60LL * 60LL * TIMEGRAN); }91 int64_t ?`w( Duration dur ) { return dur.t v/ (7LL * 24LL * 60LL * 60LL * TIMEGRAN); }92 93 Duration max( Duration lhs, Duration rhs ) { return (lhs.t v < rhs.tv) ? rhs : lhs;}94 Duration min( Duration lhs, Duration rhs ) { return !(rhs.t v < lhs.tv) ? lhs : rhs;}84 int64_t ?`ns( Duration dur ) { return dur.tn; } 85 int64_t ?`us( Duration dur ) { return dur.tn / (TIMEGRAN / 1_000_000LL); } 86 int64_t ?`ms( Duration dur ) { return dur.tn / (TIMEGRAN / 1_000LL); } 87 int64_t ?`s( Duration dur ) { return dur.tn / TIMEGRAN; } 88 int64_t ?`m( Duration dur ) { return dur.tn / (60LL * TIMEGRAN); } 89 int64_t ?`h( Duration dur ) { return dur.tn / (60LL * 60LL * TIMEGRAN); } 90 int64_t ?`d( Duration dur ) { return dur.tn / (24LL * 60LL * 60LL * TIMEGRAN); } 91 int64_t ?`w( Duration dur ) { return dur.tn / (7LL * 24LL * 60LL * 60LL * TIMEGRAN); } 92 93 Duration max( Duration lhs, Duration rhs ) { return (lhs.tn < rhs.tn) ? rhs : lhs;} 94 Duration min( Duration lhs, Duration rhs ) { return !(rhs.tn < lhs.tn) ? lhs : rhs;} 95 95 } // distribution 96 96 … … 143 143 //######################### Time ######################### 144 144 145 void ?{}( Time & time, int year, int month = 0, int day = 0, int hour = 0, int min = 0, int sec = 0, int nsec = 0 );145 void ?{}( Time & time, int year, int month = 1, int day = 1, int hour = 0, int min = 0, int sec = 0, int64_t nsec = 0 ); 146 146 static inline { 147 147 Time ?=?( Time & time, __attribute__((unused)) zero_t ) { return time{ 0 }; } 148 148 149 void ?{}( Time & time, timeval t ) with( time ) { t v= (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * 1000; }149 void ?{}( Time & time, timeval t ) with( time ) { tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * 1000; } 150 150 Time ?=?( Time & time, timeval t ) with( time ) { 151 t v= (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * (TIMEGRAN / 1_000_000LL);151 tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * (TIMEGRAN / 1_000_000LL); 152 152 return time; 153 153 } // ?=? 154 154 155 void ?{}( Time & time, timespec t ) with( time ) { t v= (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; }155 void ?{}( Time & time, timespec t ) with( time ) { tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; } 156 156 Time ?=?( Time & time, timespec t ) with( time ) { 157 t v= (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec;157 tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; 158 158 return time; 159 159 } // ?=? 160 160 161 Time ?+?( Time & lhs, Duration rhs ) { return (Time)@{ lhs.t v + rhs.tv}; }161 Time ?+?( Time & lhs, Duration rhs ) { return (Time)@{ lhs.tn + rhs.tn }; } 162 162 Time ?+?( Duration lhs, Time rhs ) { return rhs + lhs; } 163 163 Time ?+=?( Time & lhs, Duration rhs ) { lhs = lhs + rhs; return lhs; } 164 164 165 Duration ?-?( Time lhs, Time rhs ) { return (Duration)@{ lhs.t v - rhs.tv}; }166 Time ?-?( Time lhs, Duration rhs ) { return (Time)@{ lhs.t v - rhs.tv}; }165 Duration ?-?( Time lhs, Time rhs ) { return (Duration)@{ lhs.tn - rhs.tn }; } 166 Time ?-?( Time lhs, Duration rhs ) { return (Time)@{ lhs.tn - rhs.tn }; } 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.tn == rhs.tn; } 169 bool ?!=?( Time lhs, Time rhs ) { return lhs.tn != rhs.tn; } 170 bool ?<?( Time lhs, Time rhs ) { return lhs.tn < rhs.tn; } 171 bool ?<=?( Time lhs, Time rhs ) { return lhs.tn <= rhs.tn; } 172 bool ?>?( Time lhs, Time rhs ) { return lhs.tn > rhs.tn; } 173 bool ?>=?( Time lhs, Time rhs ) { return lhs.tn >= rhs.tn; } 174 175 int64_t ?`ns( Time t ) { return t.tn; } 174 176 } // distribution 175 177 … … 194 196 195 197 static inline void ?{}( timeval & t, Time time ) with( t, time ) { 196 tv_sec = t v/ TIMEGRAN; // seconds197 tv_usec = t v% TIMEGRAN / (TIMEGRAN / 1_000_000LL); // microseconds198 tv_sec = tn / TIMEGRAN; // seconds 199 tv_usec = tn % TIMEGRAN / (TIMEGRAN / 1_000_000LL); // microseconds 198 200 } // ?{} 199 201 … … 201 203 202 204 static inline void ?{}( timespec & t, Time time ) with( t, time ) { 203 tv_sec = t v/ TIMEGRAN; // seconds204 tv_nsec = t v% TIMEGRAN; // nanoseconds205 tv_sec = tn / TIMEGRAN; // seconds 206 tv_nsec = tn % TIMEGRAN; // nanoseconds 205 207 } // ?{} 208 209 //######################### C time ######################### 210 211 static inline char * ctime( time_t tp ) { char * buf = ctime( &tp ); buf[24] = '\0'; return buf; } 212 static inline char * ctime_r( time_t tp, char * buf ) { ctime_r( &tp, buf ); buf[24] = '\0'; return buf; } 213 static inline tm * gmtime( time_t tp ) { return gmtime( &tp ); } 214 static inline tm * gmtime_r( time_t tp, tm * result ) { return gmtime_r( &tp, result ); } 215 static inline tm * localtime( time_t tp ) { return localtime( &tp ); } 216 static inline tm * localtime_r( time_t tp, tm * result ) { return localtime_r( &tp, result ); } 217 218 //######################### Clock ######################### 219 220 struct Clock { // private 221 Duration offset; // for virtual clock: contains offset from real-time 222 }; 223 224 static inline { 225 void resetClock( Clock & clk, Duration adj ) with( clk ) { 226 offset = adj + __timezone`s; // timezone (global) is (UTC - local time) in seconds 227 } // resetClock 228 229 void ?{}( Clock & clk, Duration adj ) { resetClock( clk, adj ); } 230 231 Duration getResNsec() { 232 struct timespec res; 233 clock_getres( CLOCK_REALTIME, &res ); 234 return ((int64_t)res.tv_sec * TIMEGRAN + res.tv_nsec)`ns; 235 } // getRes 236 237 Duration getRes() { 238 struct timespec res; 239 clock_getres( CLOCK_REALTIME_COARSE, &res ); 240 return ((int64_t)res.tv_sec * TIMEGRAN + res.tv_nsec)`ns; 241 } // getRes 242 243 Time getTimeNsec() { // with nanoseconds 244 timespec curr; 245 clock_gettime( CLOCK_REALTIME, &curr ); 246 return (Time){ curr }; 247 } // getTimeNsec 248 249 Time getTime() { // without nanoseconds 250 timespec curr; 251 clock_gettime( CLOCK_REALTIME_COARSE, &curr ); 252 curr.tv_nsec = 0; 253 return (Time){ curr }; 254 } // getTime 255 256 Time getTime( Clock & clk ) with( clk ) { 257 return getTime() + offset; 258 } // getTime 259 260 Time ?()( Clock & clk ) with( clk ) { // alternative syntax 261 return getTime() + offset; 262 } // getTime 263 264 timeval getTime( Clock & clk ) { 265 return (timeval){ clk() }; 266 } // getTime 267 268 tm getTime( Clock & clk ) with( clk ) { 269 tm ret; 270 localtime_r( getTime( clk ).tv_sec, &ret ); 271 return ret; 272 } // getTime 273 274 Time getCPUTime() { 275 timespec ts; 276 clock_gettime( CLOCK_THREAD_CPUTIME_ID, &ts ); 277 return (Time){ ts }; 278 } // getCPUTime 279 } // distribution 206 280 207 281 // Local Variables: // -
libcfa/src/time_t.hfa
r3c67255 re0c235c 10 10 // Created On : Tue Apr 10 14:42:03 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Apr 13 07:51:47 201813 // Update Count : 612 // Last Modified On : Sun Jan 5 08:22:46 2020 13 // Update Count : 7 14 14 // 15 15 … … 20 20 21 21 struct Duration { // private 22 int64_t t v; // nanoseconds22 int64_t tn; // nanoseconds 23 23 }; // Duration 24 24 25 static inline void ?{}( Duration & dur ) with( dur ) { t v= 0; }26 static inline void ?{}( Duration & dur, __attribute__((unused)) zero_t ) with( dur ) { t v= 0; }25 static inline void ?{}( Duration & dur ) with( dur ) { tn = 0; } 26 static inline void ?{}( Duration & dur, __attribute__((unused)) zero_t ) with( dur ) { tn = 0; } 27 27 28 28 … … 30 30 31 31 struct Time { // private 32 uint64_t t v; // nanoseconds since UNIX epoch32 uint64_t tn; // nanoseconds since UNIX epoch 33 33 }; // Time 34 34 35 static inline void ?{}( Time & time ) with( time ) { t v= 0; }36 static inline void ?{}( Time & time, __attribute__((unused)) zero_t ) with( time ) { t v= 0; }35 static inline void ?{}( Time & time ) with( time ) { tn = 0; } 36 static inline void ?{}( Time & time, __attribute__((unused)) zero_t ) with( time ) { tn = 0; } 37 37 38 38 // Local Variables: //
Note: See TracChangeset
for help on using the changeset viewer.