mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-02 11:23:41 +01:00
refactored project structure
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
#include "fastfetch.h"
|
||||
|
||||
void ffPrintUptime(FFstate* state)
|
||||
{
|
||||
ffPrintLogoAndKey(state, "Uptime");
|
||||
|
||||
if(state->sysinfo.uptime < 60)
|
||||
{
|
||||
printf("%ld seconds\n", state->sysinfo.uptime);
|
||||
return;
|
||||
}
|
||||
|
||||
int days = state->sysinfo.uptime / 86400;
|
||||
int hours = (state->sysinfo.uptime - (days * 86400)) / 3600;
|
||||
int minutes = (state->sysinfo.uptime - (days * 86400) - (hours * 3600)) / 60;
|
||||
|
||||
if(days > 0)
|
||||
printf("%d day%s, ", days, days <= 1 ? "" : "s");
|
||||
|
||||
if(hours > 0)
|
||||
printf("%d hour%s, ", hours, hours <= 1 ? "" : "s");
|
||||
|
||||
if(minutes > 0)
|
||||
printf("%d min%s", minutes, minutes <= 1 ? "" : "s");
|
||||
|
||||
putchar('\n');
|
||||
}
|
||||
Reference in New Issue
Block a user