diff --git a/daemon/HTTPServer.cpp b/daemon/HTTPServer.cpp
index 90bd772f..09b00707 100644
--- a/daemon/HTTPServer.cpp
+++ b/daemon/HTTPServer.cpp
@@ -92,6 +92,8 @@ namespace http {
const char HTTP_PARAM_SAM_SESSION_ID[] = "id";
const char HTTP_PARAM_ADDRESS[] = "address";
+ static std::string ConvertTime (uint64_t time);
+
static void ShowUptime (std::stringstream& s, int seconds)
{
int num;
@@ -464,14 +466,14 @@ namespace http {
s << "
!! Invalid !!
\r\n";
s << "\r\n";
s << "
\r\n
\r\n";
- s << "Expires: " << ls.GetExpirationTime() << "
\r\n";
+ s << "Expires: " << ConvertTime(ls.GetExpirationTime()) << "
\r\n";
auto leases = ls.GetNonExpiredLeases();
s << "Non Expired Leases: " << leases.size() << "
\r\n";
for ( auto & l : leases )
{
s << "Gateway: " << l->tunnelGateway.ToBase64() << "
\r\n";
s << "TunnelID: " << l->tunnelID << "
\r\n";
- s << "EndDate: " << l->endDate << "
\r\n";
+ s << "EndDate: " << ConvertTime(l->endDate) << "
\r\n";
}
s << "
\r\n
\r\n\r\n";
}
@@ -585,7 +587,7 @@ namespace http {
}
if (!tmp_s6.str ().empty ())
{
- s << "\r\n
\r\n
";
+ s << "
\r\n
\r\n
";
s << tmp_s6.str () << "
\r\n
\r\n";
}
}
@@ -765,6 +767,16 @@ namespace http {
}
}
+ std::string ConvertTime (uint64_t time)
+ {
+ ldiv_t divTime = ldiv(time,1000);
+ time_t t = divTime.quot;
+ struct tm *tm = localtime(&t);
+ char date[128];
+ snprintf(date, sizeof(date), "%02d/%02d/%d %02d:%02d:%02d.%03ld", tm->tm_mday, tm->tm_mon + 1, tm->tm_year + 1900, tm->tm_hour, tm->tm_min, tm->tm_sec, divTime.rem);
+ return date;
+ }
+
HTTPConnection::HTTPConnection (std::string hostname, std::shared_ptr
socket):
m_Socket (socket), m_Timer (socket->get_io_service ()), m_BufferLen (0),
expected_host(hostname)