Skip to content

Commit

Permalink
Merge pull request #10 from vergoh/master
Browse files Browse the repository at this point in the history
Add uptime information to top status line
  • Loading branch information
Kalroth committed Feb 4, 2014
2 parents ee89c7b + 1416563 commit 2c76c2a
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions cgminer.c
Expand Up @@ -2395,12 +2395,37 @@ static void curses_knight_rider(int number, int y, int stepby)
mvwhline(statuswin, y, knight_rider[number] - knight_bar_width, knight_bar, knight_bar_width);
mvwhline(statuswin, y, 80, ' ', knight_bar_width+stepby);
}

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

static void curses_print_status(void)
{
struct pool *pool = current_pool();

wattron(statuswin, A_BOLD);
cg_mvwprintw(statuswin, 0, 0, " " PACKAGE " version " VERSION " - Started: %s", datestamp);
curses_print_uptime();
wclrtoeol(statuswin);
wattroff(statuswin, A_BOLD);

wattron(statuswin, menu_attr);
Expand Down

0 comments on commit 2c76c2a

Please sign in to comment.