summaryrefslogtreecommitdiff
path: root/src/undo.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-01-07 16:14:57 +0100
committerBram Moolenaar <Bram@vim.org>2017-01-07 16:14:57 +0100
commitcbd4de44e8d08fba3c09eb40ad6e36e83faf020a (patch)
treea27001fc4d918b90c8ce7c3c5eb07cefef1b689c /src/undo.c
parentc6aa475a27e3ed1645446b014c32ebf68d005d49 (diff)
downloadvim-git-cbd4de44e8d08fba3c09eb40ad6e36e83faf020a.tar.gz
patch 8.0.0149: :earlier does not work after reading the undo filev8.0.0149
Problem: ":earlier" and ":later" do not work after startup or reading the undo file. Solution: Use absolute time stamps instead of relative to the Vim start time. (Christian Brabandt, Pavel Juhas, closes #1300, closes #1254)
Diffstat (limited to 'src/undo.c')
-rw-r--r--src/undo.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/undo.c b/src/undo.c
index 57c3c2021..607f35fdd 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -2298,10 +2298,8 @@ undo_time(
}
else
{
- /* When doing computations with time_t subtract starttime, because
- * time_t converted to a long may result in a wrong number. */
if (dosec)
- target = (long)(curbuf->b_u_time_cur - starttime) + step;
+ target = (long)(curbuf->b_u_time_cur) + step;
else if (dofile)
{
if (step < 0)
@@ -2350,7 +2348,7 @@ undo_time(
else
{
if (dosec)
- closest = (long)(vim_time() - starttime + 1);
+ closest = (long)(vim_time() + 1);
else if (dofile)
closest = curbuf->b_u_save_nr_last + 2;
else
@@ -2388,7 +2386,7 @@ undo_time(
{
uhp->uh_walk = mark;
if (dosec)
- val = (long)(uhp->uh_time - starttime);
+ val = (long)(uhp->uh_time);
else if (dofile)
val = uhp->uh_save_nr;
else