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)
def69dffb3
This commit is contained in:
zeertzjq 2022-02-13 21:33:28 +08:00
parent 21283aa445
commit 0f1c705936

View File

@ -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 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) #if defined(__linux__) || defined(MSWIN)
// On a FAT filesystem, esp. under Linux, there are only 5 bits to store // 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 // the seconds. Since the roundoff is done when flushing the inode, the
// time may change unexpectedly by one second!!! // time may change unexpectedly by one second!!!
return (long)file_info->stat.st_mtim.tv_sec - mtime > 1 || (long)file_info->stat.st_mtim.tv_sec - mtime > 1
|| mtime - (long)file_info->stat.st_mtim.tv_sec > 1 || mtime - (long)file_info->stat.st_mtim.tv_sec > 1;
|| (long)file_info->stat.st_mtim.tv_nsec != mtime_ns;
#else #else
return (long)file_info->stat.st_mtim.tv_sec != mtime; || (long)file_info->stat.st_mtim.tv_sec != mtime;
#endif #endif
} }