Mercurial > vim
diff src/misc1.c @ 19396:a961efb326e5 v8.2.0256
patch 8.2.0256: time and timer related code is spread out
Commit: https://github.com/vim/vim/commit/0a8fed6231c84e4e1b3a7dd6c0d95d3f98207fe0
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Feb 14 13:22:17 2020 +0100
patch 8.2.0256: time and timer related code is spread out
Problem: Time and timer related code is spread out.
Solution: Move time and timer related code to a new file. (Yegappan
Lakshmanan, closes #5604)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 14 Feb 2020 13:30:05 +0100 |
parents | 9dc843109c97 |
children | 22f0dda71638 |
line wrap: on
line diff
--- a/src/misc1.c +++ b/src/misc1.c @@ -2597,34 +2597,3 @@ path_with_url(char_u *fname) ; return path_is_url(p); } - -/* - * Put timestamp "tt" in "buf[buflen]" in a nice format. - */ - void -add_time(char_u *buf, size_t buflen, time_t tt) -{ -#ifdef HAVE_STRFTIME - struct tm tmval; - struct tm *curtime; - - if (vim_time() - tt >= 100) - { - curtime = vim_localtime(&tt, &tmval); - if (vim_time() - tt < (60L * 60L * 12L)) - // within 12 hours - (void)strftime((char *)buf, buflen, "%H:%M:%S", curtime); - else - // longer ago - (void)strftime((char *)buf, buflen, "%Y/%m/%d %H:%M:%S", curtime); - } - else -#endif - { - long seconds = (long)(vim_time() - tt); - - vim_snprintf((char *)buf, buflen, - NGETTEXT("%ld second ago", "%ld seconds ago", seconds), - seconds); - } -}