Changes in libcfa/src/time.cfa [ff2a33e:ef346f7c]
- File:
-
- 1 edited
-
libcfa/src/time.cfa (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/time.cfa
rff2a33e ref346f7c 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 : 6512 // Last Modified On : Sun Dec 23 22:57:48 2018 13 // Update Count : 57 14 14 // 15 15 16 16 #include "time.hfa" 17 #include " fstream.hfa"17 #include "iostream.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); ends( os );45 (ostype &)(os | dur); nl( os ); 46 46 } // ?|? 47 47 } // distribution … … 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 ) { 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 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." 58 56 #endif // __CFA_DEBUG__ 59 57 … … 65 63 #ifdef __CFA_DEBUG__ 66 64 if ( month < 1 || 12 < month ) { 67 tabort( year, month, day, hour,min, sec, nsec );65 abort( CreateFmt, year, month, day, hour, (int)min, sec, nsec ); 68 66 } // if 69 67 #endif // __CFA_DEBUG__ … … 71 69 #ifdef __CFA_DEBUG__ 72 70 if ( day < 1 || 31 < day ) { 73 tabort( year, month, day, hour,min, sec, nsec );71 abort( CreateFmt, year, month, day, hour, (int)min, sec, nsec ); 74 72 } // if 75 73 #endif // __CFA_DEBUG__ … … 81 79 #ifdef __CFA_DEBUG__ 82 80 if ( epochsec == (time_t)-1 ) { 83 tabort( year, month, day, hour,min, sec, nsec );81 abort( CreateFmt, year, month, day, hour, (int)min, sec, nsec ); 84 82 } // if 85 83 #endif // __CFA_DEBUG__ … … 87 85 #ifdef __CFA_DEBUG__ 88 86 if ( tv > 2147483647LL * TIMEGRAN ) { // between 00:00:00 UTC, January 1, 1970 and 03:14:07 UTC, January 19, 2038. 89 tabort( year, month, day, hour,min, sec, nsec );87 abort( CreateFmt, year, month, day, hour, (int)min, sec, nsec ); 90 88 } // if 91 89 #endif // __CFA_DEBUG__ … … 152 150 long int ns = (tv < 0 ? -tv : tv) % TIMEGRAN; // compute nanoseconds 153 151 if ( ns == 0 ) { // none ? 154 (ostype &)(os | buf); // print date/time/year152 (ostype &)(os | buf); // print date/time/year 155 153 } else { 156 154 buf[19] = '\0'; // truncate to "Wed Jun 30 21:49:08" 157 155 char buf2[16]; 158 156 nanomsd( ns, buf2 ); // compute nanoseconds 159 (ostype &)(os | buf | buf2 | ' ' | &buf[20]); // print date/time, nanoseconds and year157 (ostype &)(os | buf | buf2 | ' ' | &buf[20]); // print date/time, nanoseconds and year 160 158 } // if 161 159 return os; … … 163 161 164 162 void ?|?( ostype & os, Time time ) with( time ) { 165 (ostype &)(os | time); ends( os );163 (ostype &)(os | time); nl( os ); 166 164 } // ?|? 167 165 } // distribution
Note:
See TracChangeset
for help on using the changeset viewer.