void get_time_file(t_stat stat) { char *time_str; int pos; ft_putchar(' '); time_str = ctime(&stat.st_mtime); pos = 4; while (pos < 10) get_time_print(time_str, &pos); if (stat.st_mtime > time(NULL) - 157788000) { while (pos < 16) get_time_print(time_str, &pos); } else { pos = 19; while (pos < 24) get_time_print(time_str, &pos); } ft_putchar(' '); }
void draw_info(struct info_window *self) { werase(self->win); if (self->sw->elapsed_time.tv_nsec != -1) { update_clock(self->sw); } /* TODO: Make the program calculate the number of spaces for * the marked section. Now, assuming that it needs 2 spaces * because 99 is the hardcoded amount of mines */ wprintw(self->win, "[%3d] Marked: %2d/%2d", get_time_print(self->sw), self->board->num_flagged, self->board->num_mines); if (self->board->state == DEFEAT) wprintw(self->win, " BOOM!"); else if (self->board->state == VICTORY) wprintw(self->win, " Victory!"); wrefresh(self->win); }