Browse Source

Total uptime length

Conflicts:
	sgminer.c
djm34
Anatoly 11 years ago committed by Jan Berdajs
parent
commit
8f10cbfac5
  1. 25
      sgminer.c

25
sgminer.c

@ -2361,6 +2361,30 @@ static bool shared_strategy(void) @@ -2361,6 +2361,30 @@ static bool shared_strategy(void)
wprintw(win, "%s", tmp42); \
} while (0)
/* Must be called with curses mutex lock held and curses_active */
static void curses_print_uptime(void)
{
struct timeval now, tv;
unsigned int days, hours;
div_t d;
cgtime(&now);
timersub(&now, &total_tv_start, &tv);
d = div(tv.tv_sec, 86400);
days = d.quot;
d = div(d.rem, 3600);
hours = d.quot;
d = div(d.rem, 60);
cg_wprintw(statuswin, " - [%u day%c %02d:%02d:%02d]"
, days
, (days == 1) ? ' ' : 's'
, hours
, d.quot
, d.rem
);
}
/* Must be called with curses mutex lock held and curses_active */
static void curses_print_status(void)
{
@ -2369,6 +2393,7 @@ static void curses_print_status(void) @@ -2369,6 +2393,7 @@ static void curses_print_status(void)
wattron(statuswin, A_BOLD);
cg_mvwprintw(statuswin, line, 0, PACKAGE " " VERSION " - Started: %s", datestamp);
curses_print_uptime();
wattroff(statuswin, A_BOLD);
mvwhline(statuswin, ++line, 0, '-', 80);

Loading…
Cancel
Save