mirror of
https://github.com/neovim/neovim.git
synced 2025-10-08 10:56:31 +00:00
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)
0a7984af56
In Nvim Test_checktime_fast() is also flaky. Add a delay to avoid that.
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user