comparison src/undo.c @ 17135:d03a52e02f1a v8.1.1567

patch 8.1.1567: localtime_r() does not respond to $TZ changes commit https://github.com/vim/vim/commit/db51730df1817fc4b6ecf5a065c69fac518ad821 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jun 18 22:53:24 2019 +0200 patch 8.1.1567: localtime_r() does not respond to $TZ changes Problem: Localtime_r() does not respond to $TZ changes. Solution: If $TZ changes then call tzset(). (Tom Ryder)
author Bram Moolenaar <Bram@vim.org>
date Tue, 18 Jun 2019 23:00:07 +0200
parents d5e1e09a829f
children 380adf86bf66
comparison
equal deleted inserted replaced
17134:afef6986c785 17135:d03a52e02f1a
3109 */ 3109 */
3110 static void 3110 static void
3111 u_add_time(char_u *buf, size_t buflen, time_t tt) 3111 u_add_time(char_u *buf, size_t buflen, time_t tt)
3112 { 3112 {
3113 #ifdef HAVE_STRFTIME 3113 #ifdef HAVE_STRFTIME
3114 # ifdef HAVE_LOCALTIME_R
3115 struct tm tmval; 3114 struct tm tmval;
3116 # endif
3117 struct tm *curtime; 3115 struct tm *curtime;
3118 3116
3119 if (vim_time() - tt >= 100) 3117 if (vim_time() - tt >= 100)
3120 { 3118 {
3121 # ifdef HAVE_LOCALTIME_R 3119 curtime = vim_localtime(&tt, &tmval);
3122 curtime = localtime_r(&tt, &tmval);
3123 # else
3124 curtime = localtime(&tt);
3125 # endif
3126 if (vim_time() - tt < (60L * 60L * 12L)) 3120 if (vim_time() - tt < (60L * 60L * 12L))
3127 /* within 12 hours */ 3121 /* within 12 hours */
3128 (void)strftime((char *)buf, buflen, "%H:%M:%S", curtime); 3122 (void)strftime((char *)buf, buflen, "%H:%M:%S", curtime);
3129 else 3123 else
3130 /* longer ago */ 3124 /* longer ago */