Mercurial > vim
comparison src/undo.c @ 9674:adc7212951ee v7.4.2113
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jul 29 16:15:27 2016 +0200
patch 7.4.2113
Problem: Test for undo is flaky.
Solution: Turn it into a new style test. Use test_settime() to avoid
flakyness.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 29 Jul 2016 16:30:06 +0200 |
parents | b2aada04d84e |
children | 4aead6a9b7a9 |
comparison
equal
deleted
inserted
replaced
9673:7c6c77fb59a4 | 9674:adc7212951ee |
---|---|
532 if (curbuf->b_u_newhead != NULL) | 532 if (curbuf->b_u_newhead != NULL) |
533 curbuf->b_u_newhead->uh_prev.ptr = uhp; | 533 curbuf->b_u_newhead->uh_prev.ptr = uhp; |
534 | 534 |
535 uhp->uh_seq = ++curbuf->b_u_seq_last; | 535 uhp->uh_seq = ++curbuf->b_u_seq_last; |
536 curbuf->b_u_seq_cur = uhp->uh_seq; | 536 curbuf->b_u_seq_cur = uhp->uh_seq; |
537 uhp->uh_time = time(NULL); | 537 uhp->uh_time = vim_time(); |
538 uhp->uh_save_nr = 0; | 538 uhp->uh_save_nr = 0; |
539 curbuf->b_u_time_cur = uhp->uh_time + 1; | 539 curbuf->b_u_time_cur = uhp->uh_time + 1; |
540 | 540 |
541 uhp->uh_walk = 0; | 541 uhp->uh_walk = 0; |
542 uhp->uh_entry = NULL; | 542 uhp->uh_entry = NULL; |
2348 closest = -1; | 2348 closest = -1; |
2349 } | 2349 } |
2350 else | 2350 else |
2351 { | 2351 { |
2352 if (dosec) | 2352 if (dosec) |
2353 closest = (long)(time(NULL) - starttime + 1); | 2353 closest = (long)(vim_time() - starttime + 1); |
2354 else if (dofile) | 2354 else if (dofile) |
2355 closest = curbuf->b_u_save_nr_last + 2; | 2355 closest = curbuf->b_u_save_nr_last + 2; |
2356 else | 2356 else |
2357 closest = curbuf->b_u_seq_last + 2; | 2357 closest = curbuf->b_u_seq_last + 2; |
2358 if (target >= closest) | 2358 if (target >= closest) |
3102 u_add_time(char_u *buf, size_t buflen, time_t tt) | 3102 u_add_time(char_u *buf, size_t buflen, time_t tt) |
3103 { | 3103 { |
3104 #ifdef HAVE_STRFTIME | 3104 #ifdef HAVE_STRFTIME |
3105 struct tm *curtime; | 3105 struct tm *curtime; |
3106 | 3106 |
3107 if (time(NULL) - tt >= 100) | 3107 if (vim_time() - tt >= 100) |
3108 { | 3108 { |
3109 curtime = localtime(&tt); | 3109 curtime = localtime(&tt); |
3110 if (time(NULL) - tt < (60L * 60L * 12L)) | 3110 if (vim_time() - tt < (60L * 60L * 12L)) |
3111 /* within 12 hours */ | 3111 /* within 12 hours */ |
3112 (void)strftime((char *)buf, buflen, "%H:%M:%S", curtime); | 3112 (void)strftime((char *)buf, buflen, "%H:%M:%S", curtime); |
3113 else | 3113 else |
3114 /* longer ago */ | 3114 /* longer ago */ |
3115 (void)strftime((char *)buf, buflen, "%Y/%m/%d %H:%M:%S", curtime); | 3115 (void)strftime((char *)buf, buflen, "%Y/%m/%d %H:%M:%S", curtime); |
3116 } | 3116 } |
3117 else | 3117 else |
3118 #endif | 3118 #endif |
3119 vim_snprintf((char *)buf, buflen, _("%ld seconds ago"), | 3119 vim_snprintf((char *)buf, buflen, _("%ld seconds ago"), |
3120 (long)(time(NULL) - tt)); | 3120 (long)(vim_time() - tt)); |
3121 } | 3121 } |
3122 | 3122 |
3123 /* | 3123 /* |
3124 * ":undojoin": continue adding to the last entry list | 3124 * ":undojoin": continue adding to the last entry list |
3125 */ | 3125 */ |