diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2015-09-27 11:55:34 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2015-09-27 11:55:34 +0100 |
| commit | e2720f1fbe09649e6da282cd33b9794867d3d0fb (patch) | |
| tree | bb5f906151c28fc5fde6078b842a71c0ba4fc318 /src/file.hh | |
| parent | 122a799ecb7dd1a6d6ff392ab9dc9d88fafad770 (diff) | |
Store timespec for buffer fs timestamps, not just time_t
time_t has a resolution of one second, which cause troubles when
a file changes multiple time during that same second.
Diffstat (limited to 'src/file.hh')
| -rw-r--r-- | src/file.hh | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/file.hh b/src/file.hh index ef51c2d8..6061d402 100644 --- a/src/file.hh +++ b/src/file.hh @@ -52,7 +52,17 @@ Vector<String> list_files(StringView directory); void make_directory(StringView dir); -time_t get_fs_timestamp(StringView filename); +timespec get_fs_timestamp(StringView filename); + +constexpr bool operator==(const timespec& lhs, const timespec& rhs) +{ + return lhs.tv_sec == rhs.tv_sec and lhs.tv_nsec == rhs.tv_nsec; +} + +constexpr bool operator!=(const timespec& lhs, const timespec& rhs) +{ + return not (lhs == rhs); +} CandidateList complete_filename(StringView prefix, const Regex& ignore_regex, ByteCount cursor_pos = -1); |
