1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16:38:41 +00:00

Implement delayed server shutdown with cancelation (#4664)

This commit is contained in:
Loïc Blot 2017-04-15 23:19:18 +02:00 committed by GitHub
parent 0f955bf7fa
commit 34d32ce55a
8 changed files with 124 additions and 14 deletions

View file

@ -614,4 +614,28 @@ inline const char *bool_to_cstr(bool val)
return val ? "true" : "false";
}
inline const std::string duration_to_string(int sec)
{
int min = floor(sec / 60);
sec %= 60;
int hour = floor(min / 60);
min %= 60;
std::stringstream ss;
if (hour > 0) {
ss << hour << "h ";
}
if (min > 0) {
ss << min << "m ";
}
if (sec > 0) {
ss << sec << "s ";
}
return ss.str();
}
#endif