Changeset 1243:7c5f662c4eef in freeDiameter
- Timestamp:
- Nov 11, 2013, 3:55:10 PM (11 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
include/freeDiameter/libfdproto.h
r1242 r1243 183 183 * buf : An array where the time must be stored 184 184 * len : size of the buffer 185 * incl_date : The day of year is included in the output 186 * incl_ms : millisecond value is included in the output 185 187 * 186 188 * DESCRIPTION: … … 190 192 * pointer to buf. 191 193 */ 192 char * fd_log_time ( struct timespec * ts, char * buf, size_t len );194 char * fd_log_time ( struct timespec * ts, char * buf, size_t len, int incl_date, int incl_ms ); 193 195 194 196 /* -
libfdproto/log.c
r1119 r1243 95 95 96 96 /* add timestamp */ 97 printf("%s ", fd_log_time(NULL, buf, sizeof(buf))); 98 97 printf("%s ", fd_log_time(NULL, buf, sizeof(buf), 98 #if (defined(DEBUG) && !defined(DEBUG_WITHOUT_META)) 99 1, 1 100 #else /* (defined(DEBUG) && !defined(DEBUG_WITHOUT_META)) */ 101 0, 0 102 #endif /* (defined(DEBUG) && !defined(DEBUG_WITHOUT_META)) */ 103 )); 99 104 /* Use colors on stdout ? */ 100 105 if (!use_colors) { … … 184 189 185 190 /* Write time into a buffer */ 186 char * fd_log_time ( struct timespec * ts, char * buf, size_t len )191 char * fd_log_time ( struct timespec * ts, char * buf, size_t len, int incl_date, int incl_ms ) 187 192 { 188 193 int ret; … … 201 206 } 202 207 203 offset += strftime(buf + offset, len - offset, "%D,%T", localtime_r( &ts->tv_sec , &tm )); 204 offset += snprintf(buf + offset, len - offset, ".%6.6ld", ts->tv_nsec / 1000); 208 offset += strftime(buf + offset, len - offset, incl_date?"%D,%T":"%T", localtime_r( &ts->tv_sec , &tm )); 209 if (incl_ms) 210 offset += snprintf(buf + offset, len - offset, ".%6.6ld", ts->tv_nsec / 1000); 205 211 206 212 return buf;
Note: See TracChangeset
for help on using the changeset viewer.