+ time_t now = time(NULL);
+ struct tm lt;
+ struct tm *ltime = localtime_r(&now, <);
+ char timestamp[1024];
+ if (ltime == NULL) {
+ strcpy(timestamp, "???");
+ } else {
+ strftime(timestamp, sizeof(timestamp), "%a, %d %b %Y %T %z", ltime);
+ }
+