Changes in libcfa/src/time.cfa [ef346f7c:ff2a33e]
- File:
-
- 1 edited
-
libcfa/src/time.cfa (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/time.cfa
ref346f7c rff2a33e 10 10 // Created On : Tue Mar 27 13:33:14 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un Dec 23 22:57:48 201813 // Update Count : 5712 // Last Modified On : Sat Jul 13 08:41:55 2019 13 // Update Count : 65 14 14 // 15 15 16 16 #include "time.hfa" 17 #include " iostream.hfa"17 #include "fstream.hfa" 18 18 #include <stdio.h> // snprintf 19 19 #include <assert.h> … … 37 37 if ( ns != 0 ) { // some ? 38 38 char buf[16]; 39 (ostype &)(os | nanomsd( ns, buf )); // print nanoseconds39 (ostype &)(os | nanomsd( ns, buf )); // print nanoseconds 40 40 } // if 41 41 return os; … … 43 43 44 44 void ?|?( ostype & os, Duration dur ) with( dur ) { 45 (ostype &)(os | dur); nl( os );45 (ostype &)(os | dur); ends( os ); 46 46 } // ?|? 47 47 } // distribution … … 52 52 53 53 #ifdef __CFA_DEBUG__ 54 #define CreateFmt "Attempt to create Time( year=%d (>=1970), month=%d (1-12), day=%d (1-31), hour=%d (0-23), min=%d (0-59), sec=%d (0-60), nsec=%d (0-999_999_999), " \ 55 "which exceeds range 00:00:00 UTC, January 1, 1970 to 03:14:07 UTC, January 19, 2038." 54 static void tabort( int year, int month, int day, int hour, int min, int sec, int nsec ) { 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."; 57 } // tabort 56 58 #endif // __CFA_DEBUG__ 57 59 … … 63 65 #ifdef __CFA_DEBUG__ 64 66 if ( month < 1 || 12 < month ) { 65 abort( CreateFmt, year, month, day, hour, (int)min, sec, nsec );67 tabort( year, month, day, hour, min, sec, nsec ); 66 68 } // if 67 69 #endif // __CFA_DEBUG__ … … 69 71 #ifdef __CFA_DEBUG__ 70 72 if ( day < 1 || 31 < day ) { 71 abort( CreateFmt, year, month, day, hour, (int)min, sec, nsec );73 tabort( year, month, day, hour, min, sec, nsec ); 72 74 } // if 73 75 #endif // __CFA_DEBUG__ … … 79 81 #ifdef __CFA_DEBUG__ 80 82 if ( epochsec == (time_t)-1 ) { 81 abort( CreateFmt, year, month, day, hour, (int)min, sec, nsec );83 tabort( year, month, day, hour, min, sec, nsec ); 82 84 } // if 83 85 #endif // __CFA_DEBUG__ … … 85 87 #ifdef __CFA_DEBUG__ 86 88 if ( tv > 2147483647LL * TIMEGRAN ) { // between 00:00:00 UTC, January 1, 1970 and 03:14:07 UTC, January 19, 2038. 87 abort( CreateFmt, year, month, day, hour, (int)min, sec, nsec );89 tabort( year, month, day, hour, min, sec, nsec ); 88 90 } // if 89 91 #endif // __CFA_DEBUG__ … … 150 152 long int ns = (tv < 0 ? -tv : tv) % TIMEGRAN; // compute nanoseconds 151 153 if ( ns == 0 ) { // none ? 152 (ostype &)(os | buf); // print date/time/year154 (ostype &)(os | buf); // print date/time/year 153 155 } else { 154 156 buf[19] = '\0'; // truncate to "Wed Jun 30 21:49:08" 155 157 char buf2[16]; 156 158 nanomsd( ns, buf2 ); // compute nanoseconds 157 (ostype &)(os | buf | buf2 | ' ' | &buf[20]); // print date/time, nanoseconds and year159 (ostype &)(os | buf | buf2 | ' ' | &buf[20]); // print date/time, nanoseconds and year 158 160 } // if 159 161 return os; … … 161 163 162 164 void ?|?( ostype & os, Time time ) with( time ) { 163 (ostype &)(os | time); nl( os );165 (ostype &)(os | time); ends( os ); 164 166 } // ?|? 165 167 } // distribution
Note:
See TracChangeset
for help on using the changeset viewer.