Changeset d7312ac for src/libcfa/time.c
- Timestamp:
- May 5, 2018, 9:33:28 AM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
- Children:
- 7867eb9
- Parents:
- 43c461d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/time.c
r43c461d rd7312ac 10 10 // Created On : Tue Mar 27 13:33:14 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Apr 12 14:41:00201813 // Update Count : 2212 // Last Modified On : Sat May 5 09:04:51 2018 13 // Update Count : 36 14 14 // 15 15 … … 17 17 #include "iostream" 18 18 #include <stdio.h> // snprintf 19 #include <assert.h> 19 20 20 21 static char * nanomsd( long int ns, char * buf ) { // most significant digits … … 87 88 time_t s = tv / TIMEGRAN; 88 89 tm tm; 89 gmtime_r( &s, &tm ); 90 gmtime_r( &s, &tm ); // tm_mon <= 11, tm_mday <= 31 91 #pragma GCC diagnostic push 92 #pragma GCC diagnostic ignored "-Wformat-truncation" 90 93 snprintf( buf, 9, "%02d/%02d/%02d", tm.tm_year % 99, tm.tm_mon + 1, tm.tm_mday ); 94 #pragma GCC diagnostic pop 91 95 return buf; 92 96 } // yy_mm_dd … … 95 99 time_t s = tv / TIMEGRAN; 96 100 tm tm; 97 gmtime_r( &s, &tm ); 101 gmtime_r( &s, &tm ); // tm_mon <= 11, tm_mday <= 31 102 #pragma GCC diagnostic push 103 #pragma GCC diagnostic ignored "-Wformat-truncation" 98 104 snprintf( buf, 9, "%02d/%02d/%02d", tm.tm_mon + 1, tm.tm_mday, tm.tm_year % 99 ); 105 #pragma GCC diagnostic pop 99 106 return buf; 100 107 } // mm_dd_yy … … 103 110 time_t s = tv / TIMEGRAN; 104 111 tm tm; 105 gmtime_r( &s, &tm ); 112 gmtime_r( &s, &tm ); // tm_mon <= 11, tm_mday <= 31 113 #pragma GCC diagnostic push 114 #pragma GCC diagnostic ignored "-Wformat-truncation" 106 115 snprintf( buf, 9, "%02d/%02d/%02d", tm.tm_mday, tm.tm_mon + 1, tm.tm_year % 99 ); 116 #pragma GCC diagnostic pop 107 117 return buf; 108 118 } // dd_mm_yy
Note: See TracChangeset
for help on using the changeset viewer.