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/buffer.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/buffer.hh')
| -rw-r--r-- | src/buffer.hh | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/buffer.hh b/src/buffer.hh index ba5a62df..5342dd83 100644 --- a/src/buffer.hh +++ b/src/buffer.hh @@ -14,7 +14,7 @@ namespace Kakoune class Buffer; -constexpr time_t InvalidTime = 0; +constexpr timespec InvalidTime = { -1, -1 }; // A BufferIterator permits to iterate over the characters of a buffer class BufferIterator @@ -79,7 +79,7 @@ public: }; Buffer(String name, Flags flags, BufferLines lines = {}, - time_t fs_timestamp = InvalidTime); + timespec fs_timestamp = InvalidTime); Buffer(const Buffer&) = delete; Buffer& operator= (const Buffer&) = delete; ~Buffer(); @@ -93,8 +93,8 @@ public: BufferIterator erase(BufferIterator begin, BufferIterator end); size_t timestamp() const; - time_t fs_timestamp() const; - void set_fs_timestamp(time_t ts); + timespec fs_timestamp() const; + void set_fs_timestamp(timespec ts); void commit_undo_group(); bool undo(); @@ -152,7 +152,7 @@ public: void run_hook_in_own_context(StringView hook_name, StringView param); - void reload(BufferLines lines, time_t fs_timestamp = InvalidTime); + void reload(BufferLines lines, timespec fs_timestamp = InvalidTime); void check_invariant() const; @@ -213,7 +213,7 @@ private: Vector<Change, MemoryDomain::BufferMeta> m_changes; - time_t m_fs_timestamp; + timespec m_fs_timestamp; // Values are just data holding by the buffer, they are not part of its // observable state |
