comparison src/memline.c @ 25953:d7e1cf30728c v8.2.3510

patch 8.2.3510: changes are only detected with one second accuracy Commit: https://github.com/vim/vim/commit/0a7984af5601323fae7b3398f05a48087db7b767 Author: Leah Neukirchen <leah@vuxu.org> Date: Thu Oct 14 21:27:55 2021 +0100 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)
author Bram Moolenaar <Bram@vim.org>
date Thu, 14 Oct 2021 22:30:04 +0200
parents a63676a1da2b
children c2d4e40a32a6
comparison
equal deleted inserted replaced
25952:7eded0585ee0 25953:d7e1cf30728c
1030 #ifdef CHECK_INODE 1030 #ifdef CHECK_INODE
1031 long_to_char((long)st.st_ino, b0p->b0_ino); 1031 long_to_char((long)st.st_ino, b0p->b0_ino);
1032 #endif 1032 #endif
1033 buf_store_time(buf, &st, buf->b_ffname); 1033 buf_store_time(buf, &st, buf->b_ffname);
1034 buf->b_mtime_read = buf->b_mtime; 1034 buf->b_mtime_read = buf->b_mtime;
1035 buf->b_mtime_read_ns = buf->b_mtime_ns;
1035 } 1036 }
1036 else 1037 else
1037 { 1038 {
1038 long_to_char(0L, b0p->b0_mtime); 1039 long_to_char(0L, b0p->b0_mtime);
1039 #ifdef CHECK_INODE 1040 #ifdef CHECK_INODE
1040 long_to_char(0L, b0p->b0_ino); 1041 long_to_char(0L, b0p->b0_ino);
1041 #endif 1042 #endif
1042 buf->b_mtime = 0; 1043 buf->b_mtime = 0;
1044 buf->b_mtime_ns = 0;
1043 buf->b_mtime_read = 0; 1045 buf->b_mtime_read = 0;
1046 buf->b_mtime_read_ns = 0;
1044 buf->b_orig_size = 0; 1047 buf->b_orig_size = 0;
1045 buf->b_orig_mode = 0; 1048 buf->b_orig_mode = 0;
1046 } 1049 }
1047 } 1050 }
1048 1051
2434 * If the original file does not exist anymore or has been changed 2437 * If the original file does not exist anymore or has been changed
2435 * call ml_preserve() to get rid of all negative numbered blocks. 2438 * call ml_preserve() to get rid of all negative numbered blocks.
2436 */ 2439 */
2437 if (mch_stat((char *)buf->b_ffname, &st) == -1 2440 if (mch_stat((char *)buf->b_ffname, &st) == -1
2438 || st.st_mtime != buf->b_mtime_read 2441 || st.st_mtime != buf->b_mtime_read
2442 #ifdef ST_MTIM_NSEC
2443 || st.ST_MTIM_NSEC != buf->b_mtime_read_ns
2444 #endif
2439 || st.st_size != buf->b_orig_size) 2445 || st.st_size != buf->b_orig_size)
2440 { 2446 {
2441 ml_preserve(buf, FALSE); 2447 ml_preserve(buf, FALSE);
2442 did_check_timestamps = FALSE; 2448 did_check_timestamps = FALSE;
2443 need_check_timestamps = TRUE; // give message later 2449 need_check_timestamps = TRUE; // give message later