aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-02-13 21:33:28 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-02-13 21:33:28 +0800
commit0f1c7059361f5db894fa0715ee6ee15d444a9c2b (patch)
tree9c9ac4ff7bcbce5ae322d4586f72f667c3479a50
parent21283aa445a0b2e13f1c6ac56512165c5bc17922 (diff)
downloadrneovim-0f1c7059361f5db894fa0715ee6ee15d444a9c2b.tar.gz
rneovim-0f1c7059361f5db894fa0715ee6ee15d444a9c2b.tar.bz2
rneovim-0f1c7059361f5db894fa0715ee6ee15d444a9c2b.zip
vim-patch:8.2.3515: nano time test fails on Mac and FreeBSD
Problem: Nano time test fails on Mac and FreeBSD. Solution: Also check nano time when not on Linux. (Ozaki Kiichi, closes vim/vim#9000) https://github.com/vim/vim/commit/def69dffb3d09a69629b071c89b7893a1783ba53
-rw-r--r--src/nvim/fileio.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 475b44bc49..110981159f 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -3913,15 +3913,15 @@ static int check_mtime(buf_T *buf, FileInfo *file_info)
static bool time_differs(const FileInfo *file_info, long mtime, long mtime_ns) FUNC_ATTR_CONST
{
+ return (long)file_info->stat.st_mtim.tv_nsec != mtime_ns
#if defined(__linux__) || defined(MSWIN)
- // On a FAT filesystem, esp. under Linux, there are only 5 bits to store
- // the seconds. Since the roundoff is done when flushing the inode, the
- // time may change unexpectedly by one second!!!
- return (long)file_info->stat.st_mtim.tv_sec - mtime > 1
- || mtime - (long)file_info->stat.st_mtim.tv_sec > 1
- || (long)file_info->stat.st_mtim.tv_nsec != mtime_ns;
+ // On a FAT filesystem, esp. under Linux, there are only 5 bits to store
+ // the seconds. Since the roundoff is done when flushing the inode, the
+ // time may change unexpectedly by one second!!!
+ || (long)file_info->stat.st_mtim.tv_sec - mtime > 1
+ || mtime - (long)file_info->stat.st_mtim.tv_sec > 1;
#else
- return (long)file_info->stat.st_mtim.tv_sec != mtime;
+ || (long)file_info->stat.st_mtim.tv_sec != mtime;
#endif
}