From e2720f1fbe09649e6da282cd33b9794867d3d0fb Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 27 Sep 2015 11:55:34 +0100 Subject: 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. --- src/buffer.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/buffer.cc') diff --git a/src/buffer.cc b/src/buffer.cc index 0685e5b3..02f076d0 100644 --- a/src/buffer.cc +++ b/src/buffer.cc @@ -18,7 +18,7 @@ namespace Kakoune { Buffer::Buffer(String name, Flags flags, BufferLines lines, - time_t fs_timestamp) + timespec fs_timestamp) : Scope(GlobalScope::instance()), m_name((flags & Flags::File) ? real_path(parse_filename(name)) : std::move(name)), m_display_name((flags & Flags::File) ? compact_path(m_name) : m_name), @@ -160,7 +160,7 @@ struct Buffer::Modification } }; -void Buffer::reload(BufferLines lines, time_t fs_timestamp) +void Buffer::reload(BufferLines lines, timespec fs_timestamp) { if (lines.empty()) lines.emplace_back(StringData::create("\n")); @@ -531,13 +531,13 @@ ByteCoord Buffer::char_prev(ByteCoord coord) const return coord; } -time_t Buffer::fs_timestamp() const +timespec Buffer::fs_timestamp() const { kak_assert(m_flags & Flags::File); return m_fs_timestamp; } -void Buffer::set_fs_timestamp(time_t ts) +void Buffer::set_fs_timestamp(timespec ts) { kak_assert(m_flags & Flags::File); m_fs_timestamp = ts; -- cgit v1.2.3