diff --git a/src/utils/common/StringUtils.cpp b/src/utils/common/StringUtils.cpp index 922ee1f1c45c..ae3418d47a52 100644 --- a/src/utils/common/StringUtils.cpp +++ b/src/utils/common/StringUtils.cpp @@ -205,26 +205,6 @@ StringUtils::substituteEnvironment(const std::string& str, const std::chrono::ti } -std::string -StringUtils::toTimeString(int time) { - std::ostringstream oss; - if (time < 0) { - oss << "-"; - time = -time; - } - char buffer[10]; - sprintf(buffer, "%02i:", (time / 3600)); - oss << buffer; - time = time % 3600; - sprintf(buffer, "%02i:", (time / 60)); - oss << buffer; - time = time % 60; - sprintf(buffer, "%02i", time); - oss << buffer; - return oss.str(); -} - - bool StringUtils::startsWith(const std::string& str, const std::string prefix) { return str.compare(0, prefix.length(), prefix) == 0; diff --git a/src/utils/common/StringUtils.h b/src/utils/common/StringUtils.h index eaa15c1f15bd..b95d968f929d 100644 --- a/src/utils/common/StringUtils.h +++ b/src/utils/common/StringUtils.h @@ -60,9 +60,6 @@ class StringUtils { syntax for a variable is ${NAME} */ static std::string substituteEnvironment(const std::string& str, const std::chrono::time_point* const timeRef = nullptr); - /// Builds a time string (hh:mm:ss) from the given seconds - static std::string toTimeString(int time); - /// Checks whether a given string starts with the prefix static bool startsWith(const std::string& str, const std::string prefix); diff --git a/unittest/src/utils/common/StringUtilsTest.cpp b/unittest/src/utils/common/StringUtilsTest.cpp index 661c7234e8f2..e44e8a22a30f 100644 --- a/unittest/src/utils/common/StringUtilsTest.cpp +++ b/unittest/src/utils/common/StringUtilsTest.cpp @@ -94,18 +94,6 @@ TEST(StringUtils, test_method_replace_empty_third_argument) { EXPECT_EQ("test", StringUtils::replace("ltestl", "l", "")); } - -/* Tests the method toTimeString. */ -TEST(StringUtils, test_method_toTimeString) { - EXPECT_EQ("-00:00:01", StringUtils::toTimeString(-1)); - EXPECT_EQ("00:00:00", StringUtils::toTimeString(0)); - EXPECT_EQ("00:00:00", StringUtils::toTimeString(-0)); - EXPECT_EQ("01:00:00", StringUtils::toTimeString(3600)); - EXPECT_EQ("00:00:01", StringUtils::toTimeString(1)); - EXPECT_EQ("49:40:00", StringUtils::toTimeString(178800)); - EXPECT_EQ("30883:00:01", StringUtils::toTimeString(111178801)); -} - /* Tests the method escapeXML. */ TEST(StringUtils, test_method_escapeXML) { std::string str;