Add start time datestamp to status output.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
diff --git a/main.c b/main.c
index 92dc4e8..3723c79 100644
--- a/main.c
+++ b/main.c
@@ -170,6 +170,7 @@ static unsigned int getwork_requested;
static char current_block[37];
static char longpoll_block[37];
static char blank[37];
+static char datestamp[40];
static void applog_and_exit(const char *fmt, ...)
{
@@ -535,7 +536,7 @@ static inline void __print_status(int thr_id)
{
wmove(statuswin, 0, 0);
wattron(statuswin, A_BOLD);
- wprintw(statuswin, " " PROGRAM_NAME " version " VERSION);
+ wprintw(statuswin, " " PROGRAM_NAME " version " VERSION " - Started: %s", datestamp);
wattroff(statuswin, A_BOLD);
wmove(statuswin, 1, 0);
whline(statuswin, '-', 80);
@@ -1946,6 +1947,7 @@ int main (int argc, char *argv[])
struct sigaction handler;
struct thr_info *thr;
char name[256];
+ struct tm tm;
if (unlikely(pthread_mutex_init(&hash_lock, NULL)))
return 1;
@@ -1960,6 +1962,17 @@ int main (int argc, char *argv[])
sigaction(SIGTERM, &handler, 0);
sigaction(SIGINT, &handler, 0);
+ gettimeofday(&total_tv_start, NULL);
+ gettimeofday(&total_tv_end, NULL);
+ localtime_r(&total_tv_start.tv_sec, &tm);
+ sprintf(datestamp, "[%d-%02d-%02d %02d:%02d:%02d]",
+ tm.tm_year + 1900,
+ tm.tm_mon + 1,
+ tm.tm_mday,
+ tm.tm_hour,
+ tm.tm_min,
+ tm.tm_sec);
+
for (i = 0; i < 36; i++) {
strcat(blank, "0");
strcat(current_block, "0");
@@ -2084,9 +2097,6 @@ int main (int argc, char *argv[])
} else
longpoll_thr_id = -1;
- gettimeofday(&total_tv_start, NULL);
- gettimeofday(&total_tv_end, NULL);
-
if (opt_n_threads ) {
cpus = calloc(num_processors, sizeof(struct cgpu_info));
if (unlikely(!cpus)) {