Mercurial > vim
diff src/evalfunc.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 | efc6f5e3b543 |
children | 3fd0765f454f |
line wrap: on
line diff
--- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -13188,9 +13188,7 @@ f_str2nr(typval_T *argvars, typval_T *re f_strftime(typval_T *argvars, typval_T *rettv) { char_u result_buf[256]; -# ifdef HAVE_LOCALTIME_R struct tm tmval; -# endif struct tm *curtime; time_t seconds; char_u *p; @@ -13202,11 +13200,7 @@ f_strftime(typval_T *argvars, typval_T * seconds = time(NULL); else seconds = (time_t)tv_get_number(&argvars[1]); -# ifdef HAVE_LOCALTIME_R - curtime = localtime_r(&seconds, &tmval); -# else - curtime = localtime(&seconds); -# endif + curtime = vim_localtime(&seconds, &tmval); /* MSVC returns NULL for an invalid value of seconds. */ if (curtime == NULL) rettv->vval.v_string = vim_strsave((char_u *)_("(Invalid)"));