Skip to content

Commit

Permalink
[FIX] : fix the dates functions
Browse files Browse the repository at this point in the history
  • Loading branch information
aiekick committed Jun 9, 2024
1 parent af9180f commit 5dd8141
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/cTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ SOFTWARE.
bool ct::iso8601ToEpoch(const std::string& vIsoDateTime, const std::string& vTimeFormat, std::time_t& vOutTime) {
if (!vIsoDateTime.empty() && !vTimeFormat.empty()) {
struct std::tm time = {};
std::istringstream ss(vIsoDateTime);
ss >> std::get_time(&time, vTimeFormat.c_str());
if (ss.good()) {
std::istringstream iss(vIsoDateTime);
iss >> std::get_time(&time, vTimeFormat.c_str());
if (!iss.fail()) {
time.tm_hour = 0;
time.tm_min = 0;
time.tm_sec = 0;
Expand All @@ -75,7 +75,7 @@ bool ct::epochToISO8601(const std::time_t& vEpochTime, std::string& vOutTime) {
auto* timeinfo = std::localtime(&tt);
std::ostringstream oss;
oss << std::put_time(timeinfo, "%Y-%m-%d");
if (oss.good()) {
if (!oss.fail()) {
vOutTime = oss.str();
return true;
}
Expand Down

0 comments on commit 5dd8141

Please sign in to comment.