MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / GetLastUpdateTime

Function GetLastUpdateTime

libi2pd/FS.cpp:254–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

252 }
253
254 uint32_t GetLastUpdateTime (const std::string & path)
255 {
256 if (!fs_lib::exists(path))
257 return 0;
258#if STD_FILESYSTEM
259 std::error_code ec;
260 auto t = std::filesystem::last_write_time (path, ec);
261 if (ec) return 0;
262/*#if __cplusplus >= 202002L // C++ 20 or higher
263 const auto sctp = std::chrono::clock_cast<std::chrono::system_clock>(t);
264#else */ // TODO: wait until implemented
265 const auto sctp = std::chrono::time_point_cast<std::chrono::system_clock::duration>(
266 t - decltype(t)::clock::now() + std::chrono::system_clock::now());
267/*#endif */
268 return std::chrono::system_clock::to_time_t(sctp);
269#else
270 boost::system::error_code ec;
271 auto t = boost::filesystem::last_write_time (path, ec);
272 return ec ? 0 : t;
273#endif
274 }
275
276 bool Remove(const std::string & path) {
277 if (!fs_lib::exists(path))

Callers 2

LoadTagsMethod · 0.85
CleanUpTagsFilesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected