mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 08:35:20 +02:00
Implement delayed server shutdown with cancelation (#4664)
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user