| 221 | } |
| 222 | |
| 223 | std::string format_time(double seconds, bool HMS_only) { |
| 224 | |
| 225 | std::string result; |
| 226 | if(!HMS_only) { |
| 227 | result = String::to_display_string(seconds) + "s"; |
| 228 | } |
| 229 | |
| 230 | if(seconds >= 60.0) { |
| 231 | while(!HMS_only && result.length() <= 10) { |
| 232 | result += " "; |
| 233 | } |
| 234 | int S = int(seconds); |
| 235 | int H = S / 3600; |
| 236 | S = S % 3600; |
| 237 | int M = S / 60; |
| 238 | S = S % 60; |
| 239 | result += String::format("(%02d:%02d:%02d)",H,M,S); |
| 240 | } |
| 241 | |
| 242 | return result; |
| 243 | } |
| 244 | |
| 245 | // Reference: https://stackoverflow.com/questions/148403/ |
| 246 | // utf8-to-from-wide-char-conversion-in-stl |
no test coverage detected