1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-10 23:08:07 +00:00

Total uptime length

Conflicts:
	sgminer.c
This commit is contained in:
Anatoly 2014-05-31 20:14:08 +08:00 committed by Jan Berdajs
parent d89e53b3db
commit 8f10cbfac5

View File

@ -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)
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);