/* the main ccache driver function */
static void ccache(int argc, char *argv[])
{
- char now[64];
- time_t t;
- struct tm *tm;
int put_object_in_manifest = 0;
struct file_hash *object_hash;
struct file_hash *object_hash_from_manifest = NULL;
/* Arguments to send to the real compiler. */
ARGS *compiler_args;
- t = time(NULL);
- tm = localtime(&t);
- if (!tm) {
- cc_log("localtime failed");
- failed();
- }
-
- if (strftime(now, sizeof(now), "%Y-%m-%d %H:%M:%S", tm) == 0) {
- cc_log("strftime failed");
- failed();
- }
-
- cc_log("=== %s ===", now);
+ cc_log("=== CCACHE STARTED =========================================");
if (base_dir) {
cc_log("Base directory: %s", base_dir);
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <time.h>
#include <zlib.h>
#ifdef HAVE_PWD_H
static void log_prefix(void)
{
+#ifdef HAVE_GETTIMEOFDAY
+ char timestamp[100];
+ struct timeval tv;
+ struct tm *tm;
+
+ gettimeofday(&tv, NULL);
+ tm = localtime(&tv.tv_sec);
+ strftime(timestamp, sizeof(timestamp), "%Y-%m-%dT%H:%M:%S", tm);
+ fprintf(logfile, "[%s.%06d %-5d] ", timestamp, (int)tv.tv_usec, getpid());
+#else
fprintf(logfile, "[%-5d] ", getpid());
+#endif
}
/*