diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-02-13 21:33:28 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-02-13 21:33:28 +0800 |
commit | 03348e5b9db3f057057a70581ef71180c3cb6527 (patch) | |
tree | e7a169e48a0a2a06e4cdd0ee0470aeaebbb6ecca /src/nvim/memline.c | |
parent | 6f5fae08a302bce6de453425a6b1c1d851112914 (diff) | |
download | rneovim-03348e5b9db3f057057a70581ef71180c3cb6527.tar.gz rneovim-03348e5b9db3f057057a70581ef71180c3cb6527.tar.bz2 rneovim-03348e5b9db3f057057a70581ef71180c3cb6527.zip |
vim-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 vim/vim#8873, closes vim/vim#8875)
https://github.com/vim/vim/commit/0a7984af5601323fae7b3398f05a48087db7b767
In Nvim Test_checktime_fast() is also flaky. Add a delay to avoid that.
Diffstat (limited to 'src/nvim/memline.c')
-rw-r--r-- | src/nvim/memline.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/nvim/memline.c b/src/nvim/memline.c index 9925971783..004ef36b36 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -704,11 +704,14 @@ static void set_b0_fname(ZERO_BL *b0p, buf_T *buf) long_to_char((long)os_fileinfo_inode(&file_info), b0p->b0_ino); buf_store_file_info(buf, &file_info); buf->b_mtime_read = buf->b_mtime; + buf->b_mtime_read_ns = buf->b_mtime_ns; } else { long_to_char(0L, b0p->b0_mtime); long_to_char(0L, b0p->b0_ino); 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; } @@ -1720,6 +1723,7 @@ void ml_sync_all(int check_file, int check_char, bool do_fsync) FileInfo file_info; if (!os_fileinfo((char *)buf->b_ffname, &file_info) || file_info.stat.st_mtim.tv_sec != buf->b_mtime_read + || file_info.stat.st_mtim.tv_nsec != buf->b_mtime_read_ns || os_fileinfo_size(&file_info) != buf->b_orig_size) { ml_preserve(buf, false, do_fsync); did_check_timestamps = false; |