comparison src/bufwrite.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 68a7e6d70a5e
children 46205b125fbd
comparison
equal deleted inserted replaced
25952:7eded0585ee0 25953:d7e1cf30728c
525 */ 525 */
526 static int 526 static int
527 check_mtime(buf_T *buf, stat_T *st) 527 check_mtime(buf_T *buf, stat_T *st)
528 { 528 {
529 if (buf->b_mtime_read != 0 529 if (buf->b_mtime_read != 0
530 && time_differs((long)st->st_mtime, buf->b_mtime_read)) 530 && time_differs(st, buf->b_mtime_read, buf->b_mtime_read_ns))
531 { 531 {
532 msg_scroll = TRUE; // don't overwrite messages here 532 msg_scroll = TRUE; // don't overwrite messages here
533 msg_silent = 0; // must give this prompt 533 msg_silent = 0; // must give this prompt
534 // don't use emsg() here, don't want to flush the buffers 534 // don't use emsg() here, don't want to flush the buffers
535 msg_attr(_("WARNING: The file has been changed since reading it!!!"), 535 msg_attr(_("WARNING: The file has been changed since reading it!!!"),
2556 // prompt when writing again. 2556 // prompt when writing again.
2557 if (mch_stat((char *)fname, &st_old) >= 0) 2557 if (mch_stat((char *)fname, &st_old) >= 0)
2558 { 2558 {
2559 buf_store_time(buf, &st_old, fname); 2559 buf_store_time(buf, &st_old, fname);
2560 buf->b_mtime_read = buf->b_mtime; 2560 buf->b_mtime_read = buf->b_mtime;
2561 buf->b_mtime_read_ns = buf->b_mtime_ns;
2561 } 2562 }
2562 } 2563 }
2563 } 2564 }
2564 msg_scroll = msg_save; 2565 msg_scroll = msg_save;
2565 2566