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)
diff --git a/src/testdir/test_stat.vim b/src/testdir/test_stat.vim
index 5cd82b8..b565281 100644
--- a/src/testdir/test_stat.vim
+++ b/src/testdir/test_stat.vim
@@ -76,6 +76,39 @@
call delete(fname)
endfunc
+func Test_checktime_fast()
+ CheckFeature nanotime
+
+ let fname = 'Xtest.tmp'
+
+ let fl = ['Hello World!']
+ call writefile(fl, fname)
+ set autoread
+ exec 'e' fname
+ let fl = readfile(fname)
+ let fl[0] .= ' - checktime'
+ call writefile(fl, fname)
+ checktime
+ call assert_equal(fl[0], getline(1))
+
+ call delete(fname)
+endfunc
+
+func Test_autoread_fast()
+ CheckFeature nanotime
+
+ new Xautoread
+ set autoread
+ call setline(1, 'foo')
+
+ w!
+ silent !echo bar > Xautoread
+ checktime
+
+ call assert_equal('bar', trim(getline(1)))
+ call delete('Xautoread')
+endfunc
+
func Test_autoread_file_deleted()
new Xautoread
set autoread