Skip to content

Commit

Permalink
Small clangtidy things.
Browse files Browse the repository at this point in the history
  • Loading branch information
Peguen committed Dec 4, 2024
1 parent 532f671 commit 4b0809b
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions ecal/core/src/logging/ecal_log_provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
#include <ecal/ecal_time.h>
#include <ecal_utils/filesystem.h>

#include <iostream>
#include <chrono>
#include <iostream>
#include <sstream>

#ifdef ECAL_OS_WINDOWS
#include "ecal_win_main.h"
Expand All @@ -47,29 +48,34 @@ namespace
#ifdef ECAL_OS_LINUX
#include <sys/stat.h>
#include <sys/time.h>
#include <bits/types/struct_timeval.h>
#include <ctime>

static bool isDirectory(const std::string& path_)
{
if (path_.empty()) return false;
namespace{
bool isDirectory(const std::string& path_)
{
if (path_.empty()) return false;

struct stat st;
if (stat(path_.c_str(), &st) == 0)
return S_ISDIR(st.st_mode);
struct stat st;
if (stat(path_.c_str(), &st) == 0)
return S_ISDIR(st.st_mode);

return false;
}
return false;
}

static std::string get_time_str()
{
char fmt[64];
struct timeval tv;
struct tm *tm;
gettimeofday(&tv, NULL);
if ((tm = localtime(&tv.tv_sec)) != NULL)
std::string get_time_str()
{
strftime(fmt, sizeof fmt, "%Y-%m-%d-%H-%M-%S", tm);
char fmt[64];
struct timeval tv;
struct tm *tm = nullptr;
gettimeofday(&tv, nullptr);
tm = localtime(&tv.tv_sec);
if (tm != nullptr)
{
strftime(fmt, sizeof fmt, "%Y-%m-%d-%H-%M-%S", tm);
}
return(std::string(fmt));
}
return(std::string(fmt));
}
#endif

Expand Down

0 comments on commit 4b0809b

Please sign in to comment.