fixed uptime

This commit is contained in:
Your Name 2024-01-03 17:13:10 +03:00
parent 889e6293fd
commit d28f74ea00
2 changed files with 7 additions and 13 deletions

View File

@ -9,7 +9,7 @@ typedef struct {
} PARAMETR; } PARAMETR;
/* Config, EDIT THERE */ /* Config, EDIT THERE */
#define COLORS "\033[31m<> \033[32m<> \033[33m<> \033[34m<> \033[35m<> \033[36m<>\033[0m" #define COLORS " \033[31mx \033[32mx \033[33mx \033[34mx \033[35mx \033[0m"
#define FONT_COLOR "\033[1;37m" #define FONT_COLOR "\033[1;37m"
/* #define PRINT_TOTAL_MEM */ /* #define PRINT_TOTAL_MEM */
@ -18,17 +18,11 @@ typedef struct {
#ifdef _MAIN_H #ifdef _MAIN_H
PARAMETR CONFIG[] = { PARAMETR CONFIG[] = {
{" os ", PrintOs}, {" ", Blank},
{" kr ", GetKernel}, {"\033[1;31m  ", PrintOs},
{" usr ", GetUser}, {"", GetKernel},
{" upt ", GetUptime}, {"", GetUptime},
{" arch ", GetArch}, {"", GetPkg},
{"shell ", GetShell},
{" pkgs ", GetPkg},
{" mem ", GetMem},
{"model ", GetModel},
{" host ", GetHostname},
{" lAVG ", GetAVG},
{" ", Blank}, {" ", Blank},
{COLORS, Blank} {COLORS, Blank}
}; };

View File

@ -130,7 +130,7 @@ int GetUptime(const char *title, const FETCH fetch) {
int mins = (uptime.tv_sec / 60) - (uptime.tv_sec / 3600 * 60); int mins = (uptime.tv_sec / 60) - (uptime.tv_sec / 3600 * 60);
if (days > 0) if (days > 0)
printf("%s%s%s%dd %dh %dm", fetch.color, title, fetch.font_color, days, hours, mins); printf("%s%s%s%d days", fetch.color, title, fetch.font_color, days);
else else
printf("%s%s%s%dh %dm", fetch.color, title, fetch.font_color, hours, mins); printf("%s%s%s%dh %dm", fetch.color, title, fetch.font_color, hours, mins);