diff options
author | Wuzzy <Wuzzy2@mail.ru> | 2021-03-15 01:59:52 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2021-03-16 18:37:46 +0100 |
commit | 62e3593944846c0e7395586183986e0f11ad9544 (patch) | |
tree | 57a3cada18e6db2f97327e8aee7d644684d8a7cb /src/util | |
parent | 91135381421f646e0f6a8d9201b5cdc7e42605e1 (diff) | |
download | minetest-62e3593944846c0e7395586183986e0f11ad9544.tar.gz minetest-62e3593944846c0e7395586183986e0f11ad9544.tar.bz2 minetest-62e3593944846c0e7395586183986e0f11ad9544.zip |
Tweak duration_to_string formatting
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/string.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/util/string.h b/src/util/string.h index d4afcaec8..21f1d6877 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -670,15 +670,19 @@ inline const std::string duration_to_string(int sec) std::stringstream ss; if (hour > 0) { - ss << hour << "h "; + ss << hour << "h"; + if (min > 0 || sec > 0) + ss << " "; } if (min > 0) { - ss << min << "m "; + ss << min << "min"; + if (sec > 0) + ss << " "; } if (sec > 0) { - ss << sec << "s "; + ss << sec << "s"; } return ss.str(); |