1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-06-30 03:56:45 +02:00

easier way to format timestamps

This commit is contained in:
Jfreegman
2014-03-12 03:08:13 -04:00
parent 5e377639c8
commit ce76896eb3
2 changed files with 9 additions and 10 deletions

View File

@ -67,10 +67,11 @@ struct tm *get_time(void)
/* Prints the time to given window */
void print_time(WINDOW *window)
{
struct tm *timeinfo = get_time();
uint8_t s[MAX_STR_SIZE];
strftime(s, MAX_STR_SIZE, "[%H:%M] ", get_time());
wattron(window, COLOR_PAIR(BLUE));
wprintw(window, "[%d:%02d:%02d] ", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec);
wprintw(window, "%s", s);
wattroff(window,COLOR_PAIR(BLUE));
}