I need to convert st_mtime
returned from the stat
structure as given here man page for stat function into c++ string.
struct stat fs;
stat(some_path, &fs);
auto modificationTime = fs.st_mtime;
// Convert modificationTime into C++ string
How could I do this?
One of the solution I saw was std::to_string(static_cast<long>(fs.st_mtime)))
. Could someone also explain what is happening here?