summaryrefslogtreecommitdiffstats
path: root/src/memline.c
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2021-10-14 21:27:55 +0100
committerBram Moolenaar <Bram@vim.org>2021-10-14 21:27:55 +0100
commit0a7984af5601323fae7b3398f05a48087db7b767 (patch)
tree22efd296a4db294d3e9288c5d2085c1a5679ae82 /src/memline.c
parent340dd0fbe462a15a9678cfba02085b4adcc45f02 (diff)
patch 8.2.3510: changes are only detected with one second accuracyv8.2.3510
Problem: Changes are only detected with one second accuracy. Solution: Use the nanosecond time if possible. (Leah Neukirchen, closes #8873, closes #8875)
Diffstat (limited to 'src/memline.c')
-rw-r--r--src/memline.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/memline.c b/src/memline.c
index 6ea860d4fe..bfbf4e2807 100644
--- a/src/memline.c
+++ b/src/memline.c
@@ -1032,6 +1032,7 @@ set_b0_fname(ZERO_BL *b0p, buf_T *buf)
#endif
buf_store_time(buf, &st, buf->b_ffname);
buf->b_mtime_read = buf->b_mtime;
+ buf->b_mtime_read_ns = buf->b_mtime_ns;
}
else
{
@@ -1040,7 +1041,9 @@ set_b0_fname(ZERO_BL *b0p, buf_T *buf)
long_to_char(0L, b0p->b0_ino);
#endif
buf->b_mtime = 0;
+ buf->b_mtime_ns = 0;
buf->b_mtime_read = 0;
+ buf->b_mtime_read_ns = 0;
buf->b_orig_size = 0;
buf->b_orig_mode = 0;
}
@@ -2436,6 +2439,9 @@ ml_sync_all(int check_file, int check_char)
*/
if (mch_stat((char *)buf->b_ffname, &st) == -1
|| st.st_mtime != buf->b_mtime_read
+#ifdef ST_MTIM_NSEC
+ || st.ST_MTIM_NSEC != buf->b_mtime_read_ns
+#endif
|| st.st_size != buf->b_orig_size)
{
ml_preserve(buf, FALSE);