0
0
mirror of https://github.com/vim/vim.git synced 2025-09-30 04:44:14 -04:00

patch 8.2.3510: changes are only detected with one second accuracy

Problem:    Changes are only detected with one second accuracy.
Solution:   Use the nanosecond time if possible.  (Leah Neukirchen,
            closes #8873, closes #8875)
This commit is contained in:
Leah Neukirchen
2021-10-14 21:27:55 +01:00
committed by Bram Moolenaar
parent 340dd0fbe4
commit 0a7984af56
13 changed files with 151 additions and 6 deletions

View File

@@ -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);