27#include <fmt/format.h>
48 if (r.find(
":") == std::string::npos) {
57 if (hrt.size() == 3) {
60 }
else if (hrt.size() == 4) {
64 throw TimeFormatException(
"Input string '" + r +
"' is not a valid time format (jj:HH:MM:SS.S).");
71 if (r.find(
":") == std::string::npos) {
80 if (hrt.size() == 3) {
82 }
else if (hrt.size() == 4) {
95 const fmt::format_int digits(value);
97 const std::string digits = std::to_string(value);
99 if ((
int)digits.size() < width) {
100 result.append(width - (
int)digits.size(),
'0');
102 result.append(digits.data(), digits.size());
108 const bool negative = t < 0;
115 t = (t + scale / 2) / scale;
121 std::string result = negative ?
"-" :
"";
123 const SUMOTime minute = 60 * second;
140 if (t != 0 ||
TS < 1.) {
166 return toString((
double)t / 1000.0) +
"s";
174 if (begin % deltaT == 0) {
175 if (t % deltaT != 0) {
179 if ((t - begin) % deltaT != 0) {
181 +
" and begin time " +
time2string(begin) + error +
".")
#define WRITE_WARNING(msg)
void checkTimeBounds(const double time)
check the valid SUMOTime range of double input and throw an error if out of bounds
std::string elapsedMs2string(long long int t)
convert ms to string for log output
bool checkStepLengthMultiple(const SUMOTime t, const std::string &error, SUMOTime deltaT, SUMOTime begin)
check if given SUMOTime is multiple of the step length
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
bool isTime(const std::string &r)
check if the given string is a valid time
static void appendPadded(std::string &result, SUMOTime value, int width)
constexpr SUMOTime TIME2STEPS(double x)
int gPrecision
the precision for floating point outputs
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
std::vector< std::string > getVector()
return vector of strings
static bool isDouble(const std::string &sData)
check if the given sData can be conveted to double
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
static bool isInt(const std::string &sData)
check if the given sData can be converted to int