Skip to content

Commit b08986b

Browse files
author
Thorsten Ludewig
committed
fix format, time_t is now 'signed long long'
1 parent 5bd2a6f commit b08986b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/App/App.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ const char *appDateTime()
2727
{
2828
time_t now = time(nullptr);
2929
localtime_r( &now, &appTimeinfo );
30-
sprintf( appDateTimeBuffer, "%4d-%02d-%02d %02d:%02d:%02d",
30+
sprintf( appDateTimeBuffer, "%4d-%02hd-%02hd %02hd:%02hd:%02hd",
3131
appTimeinfo.tm_year+1900, appTimeinfo.tm_mon+1, appTimeinfo.tm_mday,
32-
appTimeinfo.tm_hour, appTimeinfo.tm_min, appTimeinfo.tm_sec );
32+
appTimeinfo.tm_hour, appTimeinfo.tm_min, appTimeinfo.tm_sec);
3333
return appDateTimeBuffer;
3434
}
3535

@@ -40,9 +40,11 @@ const char *appUptime()
4040
int uptimeMinutes = (uptime / 60) % 60;
4141
int uptimeHours = (uptime / 3600) % 24;
4242
time_t uptimeDays = (uptime / 86400);
43+
4344
sprintf( appUptimeBuffer,
44-
"%ld days, %d hours, %d minutes, %d seconds",
45+
"%llu days, %d hours, %d minutes, %d seconds",
4546
uptimeDays, uptimeHours, uptimeMinutes, uptimeSeconds );
47+
4648
return appUptimeBuffer;
4749
}
4850

lib/WebHandler/WebHandler.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const char *getJsonStatus(WiFiClient *client)
4646
"\"ctime\":\"%s\","
4747
"\"timezone\":\"%s\","
4848
"\"uptime\":\"%s\","
49+
"\"dateTime\":\"%s\","
4950
"\"host_name\":\"%s.local\","
5051
"\"esp_full_version\":\"%s\","
5152
"\"esp_core_version\":\"%s\","
@@ -86,6 +87,7 @@ const char *getJsonStatus(WiFiClient *client)
8687
strtok( ctime(&now), "\n" ),
8788
TIMEZONE,
8889
appUptime(),
90+
appDateTime(),
8991
wifiHandler.getHostname(),
9092
ESP.getFullVersion().c_str(),
9193
ESP.getCoreVersion().c_str(),

0 commit comments

Comments
 (0)