12#ifndef OPENVPN_COMMON_STAT_H
13#define OPENVPN_COMMON_STAT_H
23inline bool is_directory(
const std::string &pathname,
const bool follow_symlinks =
false)
29 return ::stat(pathname.c_str(), &sb) == 0 && S_ISDIR(sb.st_mode);
31 return ::lstat(pathname.c_str(), &sb) == 0 && S_ISDIR(sb.st_mode);
38 if (::stat(filename.c_str(), &buffer) != 0)
41 return buffer.st_mtime;
47 typedef std::uint64_t T;
49 return T(s.st_mtimespec.tv_sec) * T(1000000000) + T(s.st_mtimespec.tv_nsec);
51 return T(s.st_mtim.tv_sec) * T(1000000000) + T(s.st_mtim.tv_nsec);
59 if (::stat(filename, &s) == 0)
75 if (::fstat(fd, &s) == 0)
std::uint64_t stat_mod_time_nanoseconds(const struct stat &s)
std::uint64_t file_mod_time_milliseconds(const std::string &filename)
time_t file_mod_time(const std::string &filename)
bool is_directory(const std::string &pathname, const bool follow_symlinks=false)
std::uint64_t file_mod_time_nanoseconds(const char *filename)
std::uint64_t fd_mod_time_nanoseconds(const int fd)