Additional Diagnostics

This commit is contained in:
Rene Zeldenthuis
2022-07-05 15:49:07 +02:00
parent cf5188d034
commit 0db0a5d479
3 changed files with 99 additions and 3 deletions

11
include/format_duration.h Normal file
View File

@@ -0,0 +1,11 @@
#pragma once
String format_duration(time_t seconds)
{
auto days = seconds / (60 * 60 * 24);
auto tm = gmtime(&seconds);
String duration = days > 0 ? String(days) + " days, " : "";
char time_buff[9];
strftime(time_buff, 9, "%H:%M:%S", tm);
return duration + time_buff;
}