aboutsummaryrefslogtreecommitdiff
path: root/butl/timestamp.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-06-18 17:27:25 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-06-18 17:27:25 +0200
commitc828e2bb39f711c82c3b816f57ddde9ab29bdb20 (patch)
treeb1d9361660a6fe3f0f4340c35c3699feb066dc75 /butl/timestamp.cxx
parent2f6392f4b0c3cc6caffbfac0911dba99f5094887 (diff)
Move path_mtime to filesystem, rename file_mtime, follow symlinks
Diffstat (limited to 'butl/timestamp.cxx')
-rw-r--r--butl/timestamp.cxx44
1 files changed, 0 insertions, 44 deletions
diff --git a/butl/timestamp.cxx b/butl/timestamp.cxx
index 2d02416..f9f5455 100644
--- a/butl/timestamp.cxx
+++ b/butl/timestamp.cxx
@@ -4,10 +4,6 @@
#include <butl/timestamp>
-#include <unistd.h> // stat
-#include <sys/types.h> // stat
-#include <sys/stat.h> // stat
-
#include <time.h> // localtime, gmtime, strftime
#include <ostream>
@@ -17,46 +13,6 @@ using namespace std;
namespace butl
{
- // Figuring out whether we have the nanoseconds in some form.
- //
- template <typename S>
- constexpr auto nsec (const S* s) -> decltype(s->st_mtim.tv_nsec)
- {
- return s->st_mtim.tv_nsec; // POSIX (GNU/Linux, Solaris).
- }
-
- template <typename S>
- constexpr auto nsec (const S* s) -> decltype(s->st_mtimespec.tv_nsec)
- {
- return s->st_mtimespec.tv_nsec; // MacOS X.
- }
-
- template <typename S>
- constexpr auto nsec (const S* s) -> decltype(s->st_mtime_n)
- {
- return s->st_mtime_n; // AIX 5.2 and later.
- }
-
- template <typename S>
- constexpr int nsec (...) {return 0;}
-
- timestamp
- path_mtime (const path& p)
- {
- struct stat s;
- if (stat (p.string ().c_str (), &s) != 0)
- {
- if (errno == ENOENT || errno == ENOTDIR)
- return timestamp_nonexistent;
- else
- throw system_error (errno, system_category ());
- }
-
- return system_clock::from_time_t (s.st_mtime) +
- chrono::duration_cast<duration> (
- chrono::nanoseconds (nsec<struct stat> (&s)));
- }
-
ostream&
operator<< (ostream& os, const timestamp& ts)
{