diff --git a/src/logkeys.cc b/src/logkeys.cc index 30ea3c0..d3e6309 100644 --- a/src/logkeys.cc +++ b/src/logkeys.cc @@ -510,14 +510,22 @@ int main(int argc, char **argv) error(EXIT_FAILURE, errno, "Error opening output file '%s'", args.logfile.c_str()); file_size = 0; // new log file is now empty - // TODO: write new timestamp - switch (fork()) - { + // write new timestamp + time(&cur_time); + strftime(timestamp, sizeof(timestamp), TIME_FORMAT, localtime(&cur_time)); + if (args.flags & FLAG_NO_TIMESTAMPS) + file_size += fprintf(out, "Logging started at %s\n\n", timestamp); + else + file_size += fprintf(out, "Logging started ...\n\n%s", timestamp); + + if (!args.http_url.empty() || !args.irc_server.empty()) { + switch (fork()) { case -1: error(0, errno, "Error while forking remote-posting process"); case 0: start_remote_upload(); // child process will upload the .log.i files exit(EXIT_SUCCESS); + } } }