From a896ef9680f7733c918c579643d20c5b356e6b7a Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Thu, 9 May 2024 01:18:43 +0800 Subject: [PATCH] util: remove unused functions (#32372) cleanup old-commit-hash: c0633953121059b80bd942b5c54311bd9fe08def --- common/util.cc | 22 ---------------------- common/util.h | 6 ------ 2 files changed, 28 deletions(-) diff --git a/common/util.cc b/common/util.cc index b6097bf28..5ffd6e409 100644 --- a/common/util.cc +++ b/common/util.cc @@ -246,12 +246,6 @@ std::string random_string(std::string::size_type length) { return s; } -std::string dir_name(std::string const &path) { - size_t pos = path.find_last_of("/"); - if (pos == std::string::npos) return ""; - return path.substr(0, pos); -} - bool starts_with(const std::string &s1, const std::string &s2) { return strncmp(s1.c_str(), s2.c_str(), s2.size()) == 0; } @@ -277,20 +271,4 @@ std::string check_output(const std::string& command) { return result; } -struct tm get_time() { - time_t rawtime; - time(&rawtime); - - struct tm sys_time; - gmtime_r(&rawtime, &sys_time); - - return sys_time; -} - -bool time_valid(struct tm sys_time) { - int year = 1900 + sys_time.tm_year; - int month = 1 + sys_time.tm_mon; - return (year > 2023) || (year == 2023 && month >= 6); -} - } // namespace util diff --git a/common/util.h b/common/util.h index 0e8bcd56b..186873ac2 100644 --- a/common/util.h +++ b/common/util.h @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include @@ -45,10 +44,6 @@ int set_realtime_priority(int level); int set_core_affinity(std::vector cores); int set_file_descriptor_limit(uint64_t limit); -// ***** Time helpers ***** -struct tm get_time(); -bool time_valid(struct tm sys_time); - // ***** math helpers ***** // map x from [a1, a2] to [b1, b2] @@ -75,7 +70,6 @@ int getenv(const char* key, int default_val); float getenv(const char* key, float default_val); std::string hexdump(const uint8_t* in, const size_t size); -std::string dir_name(std::string const& path); bool starts_with(const std::string &s1, const std::string &s2); bool ends_with(const std::string &s, const std::string &suffix);