22 std::string formattedTime =
"0:00.000";
26 std::stringstream timeAsStringstream;
27 timeAsStringstream << time;
28 std::string timeAsString = timeAsStringstream.str();
30 int minutes = floor(time / (1000 * 60));
31 int seconds = floor((time - (minutes * 60 * 1000)) / 1000);
33 if(timeAsString.length() > 3)
35 tseconds = atoi(timeAsString.substr((timeAsString.length() - 3)).c_str());
38 char formattedCharArray[8];
39 sprintf(formattedCharArray,
"%d:%02d.%03d", minutes, seconds, tseconds);
41 return std::string(formattedCharArray);
53 time_t now = time(NULL);
54 strftime(buffer, 20,
"%Y-%m-%d %H:%M:%S", localtime(&now));
56 return std::string(buffer);
Contains utilities to format map times.
Definition: Time.h:12
static std::string FormatTime(int time)
Formats time to 0:00.000 format.
Definition: Time.h:20
static std::string Current()
Returns the current time in yyyy-mm-dd hh:mm:ss format.
Definition: Time.h:50