Changeset 481 for trunk/src/sh_log_parse_generic.c
- Timestamp:
- Jul 18, 2015, 5:06:52 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_log_parse_generic.c
r362 r481 46 46 static void default_time (struct sh_logrecord * record) 47 47 { 48 struct tm ts; 48 struct tm ts; 49 struct tm * ts_ptr; 49 50 char tmp[80]; 50 51 size_t len; … … 53 54 54 55 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_LOCALTIME_R) 55 localtime_r (&(record->timestamp), &ts);56 ts_ptr = localtime_r (&(record->timestamp), &ts); 56 57 #else 57 memcpy(&ts, localtime(&(record->timestamp)), sizeof(struct tm)); 58 ts_ptr = localtime(&(record->timestamp)); 59 if (ts_ptr) 60 memcpy(&ts, ts_ptr, sizeof(struct tm)); 58 61 #endif 59 len = strftime(tmp, sizeof(tmp), _("%Y-%m-%dT%H:%M:%S"), &ts); 60 62 if (ts_ptr) 63 len = strftime(tmp, sizeof(tmp), _("%Y-%m-%dT%H:%M:%S"), &ts); 64 else 65 { 66 sl_strlcpy(tmp, _("1970-01-01T00:00:00"), sizeof(tmp)); 67 len = strlen(tmp); 68 } 61 69 record->timestr = sh_string_new_from_lchar(tmp, len); 62 70
Note:
See TracChangeset
for help on using the changeset viewer.