mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 14:12:16 +03:00
добавление pretty времени в gate mysensors
This commit is contained in:
@@ -32,4 +32,31 @@ const String prettySeconds(unsigned long time_s) {
|
||||
|
||||
const String prettyMillis(unsigned long time_ms) {
|
||||
return prettySeconds(time_ms / 1000);
|
||||
}
|
||||
|
||||
const String prettyMinutsTimeout(unsigned long time_m) {
|
||||
unsigned long tmp = time_m * 60;
|
||||
unsigned long seconds;
|
||||
unsigned long minutes;
|
||||
unsigned long hours;
|
||||
unsigned long days;
|
||||
seconds = tmp % 60;
|
||||
tmp = tmp / 60;
|
||||
|
||||
minutes = tmp % 60;
|
||||
tmp = tmp / 60;
|
||||
|
||||
hours = tmp % 24;
|
||||
days = tmp / 24;
|
||||
|
||||
char buf[32];
|
||||
|
||||
if (days) {
|
||||
sprintf_P(buf, "%d day %d hr %d min", days, hours, minutes, seconds);
|
||||
} else if (hours && !days) {
|
||||
sprintf_P(buf, "%d hr %d min", hours, minutes);
|
||||
} else {
|
||||
sprintf_P(buf, "%d min", minutes);
|
||||
}
|
||||
return String(buf);
|
||||
}
|
||||
Reference in New Issue
Block a user