From 82fa06c4c052c754ea66f01d598d76db499b82f7 Mon Sep 17 00:00:00 2001 From: Roberto Scolaro Date: Sat, 10 Feb 2024 18:25:52 +0000 Subject: [PATCH] chore(libsinsp): remove unused parse_iso8601_utc_string function Signed-off-by: Roberto Scolaro --- userspace/libsinsp/utils.cpp | 28 ---------------------------- userspace/libsinsp/utils.h | 5 ----- 2 files changed, 33 deletions(-) diff --git a/userspace/libsinsp/utils.cpp b/userspace/libsinsp/utils.cpp index 5c1abf3255..a1bac0a797 100644 --- a/userspace/libsinsp/utils.cpp +++ b/userspace/libsinsp/utils.cpp @@ -1049,34 +1049,6 @@ void sinsp_utils::ts_to_iso_8601(uint64_t ts, OUT std::string* res) // Time utility functions. /////////////////////////////////////////////////////////////////////////////// -bool sinsp_utils::parse_iso_8601_utc_string(const std::string& time_str, uint64_t &ns) -{ -#ifndef _WIN32 - tm tm_time{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - char* rem = strptime(time_str.c_str(), "%Y-%m-%dT%H:%M:", &tm_time); - if(rem == NULL || *rem == '\0') - { - return false; - } - tm_time.tm_isdst = -1; // strptime does not set this, signal timegm to determine DST - ns = timegm(&tm_time) * ONE_SECOND_IN_NS; - - // Handle the possibly fractional seconds now. Also verify - // that the string ends with Z. - double fractional_secs; - if(sscanf(rem, "%lfZ", &fractional_secs) != 1) - { - return false; - } - - ns += (fractional_secs * ONE_SECOND_IN_NS); - - return true; -#else - throw sinsp_exception("parse_iso_8601_utc_string() not implemented on Windows"); -#endif -} - time_t get_epoch_utc_seconds(const std::string& time_str, const std::string& fmt) { #ifndef _WIN32 diff --git a/userspace/libsinsp/utils.h b/userspace/libsinsp/utils.h index 6c79173072..a52028ea64 100644 --- a/userspace/libsinsp/utils.h +++ b/userspace/libsinsp/utils.h @@ -137,11 +137,6 @@ class sinsp_utils static void ts_to_iso_8601(uint64_t ts, OUT std::string* res); - // Limited version of iso 8601 time string parsing, that assumes a - // timezone of Z for UTC, but does support parsing fractional seconds, - // unlike get_epoch_utc_seconds_* below. - static bool parse_iso_8601_utc_string(const std::string& time_str, uint64_t &ns); - // // Convert caps from their numeric representation to a space-separated string list //