Browse Source

Print time in log messages

Georgi Chorbadzhiyski 13 years ago
parent
commit
5b3b28b93b
1 changed files with 7 additions and 1 deletions
  1. 7
    1
      tsdecrypt.c

+ 7
- 1
tsdecrypt.c View File

@@ -59,7 +59,13 @@ void ts_free(struct ts **pts) {
59 59
 }
60 60
 
61 61
 void LOG_func(const char *msg) {
62
-	fprintf(stderr, "%s", msg);
62
+	char date[64];
63
+	struct tm tm;
64
+	time_t now;
65
+	now = time(NULL);
66
+	localtime_r(&now, &tm);
67
+	strftime(date, sizeof(date), "%F %H:%M:%S", localtime(&now));
68
+	fprintf(stderr, "%s | %s", date, msg);
63 69
 }
64 70
 
65 71
 enum CA_system req_CA_sys = CA_CONNAX;

Loading…
Cancel
Save