Uptime / Users: add years, days-of-year and year-fraction

Like what `Disk` has
This commit is contained in:
李通洲
2025-07-16 09:51:58 +08:00
parent a734f18fd5
commit 6851e7b082
5 changed files with 71 additions and 37 deletions
+8
View File
@@ -78,6 +78,8 @@ void ffPrintUsers(FFUsersOptions* options)
duration /= 24;
uint32_t days = (uint32_t) duration;
FFTimeGetAgeResult age = ffTimeGetAge(user->loginTime, ffTimeGetNow());
FF_PRINT_FORMAT_CHECKED(FF_USERS_MODULE_NAME, users.length == 1 ? 0 : (uint8_t) (i + 1), &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
FF_FORMAT_ARG(user->name, "name"),
FF_FORMAT_ARG(user->hostName, "host-name"),
@@ -89,6 +91,9 @@ void ffPrintUsers(FFUsersOptions* options)
FF_FORMAT_ARG(minutes, "minutes"),
FF_FORMAT_ARG(seconds, "seconds"),
FF_FORMAT_ARG(milliseconds, "milliseconds"),
FF_FORMAT_ARG(age.years, "years"),
FF_FORMAT_ARG(age.daysOfYear, "days-of-year"),
FF_FORMAT_ARG(age.yearsFraction, "years-fraction"),
}));
}
}
@@ -222,6 +227,9 @@ static FFModuleBaseInfo ffModuleInfo = {
{"Minutes after login", "minutes"},
{"Seconds after login", "seconds"},
{"Milliseconds after login", "milliseconds"},
{"Years integer after login", "years"},
{"Days of year after login", "days-of-year"},
{"Years fraction after login", "years-fraction"},
}))
};