diff options
| author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-03-29 11:59:22 -0400 |
|---|---|---|
| committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-03-29 13:17:03 -0400 |
| commit | 10c5434f9c1219d480fd07e711838e22dc912bba (patch) | |
| tree | 13e7f17f37869cf2c9909d651bb901c5430e7c9e /src/nvim/testdir | |
| parent | 573671b1fbcbc43b622391f50f4df30594f14751 (diff) | |
| download | rneovim-10c5434f9c1219d480fd07e711838e22dc912bba.tar.gz rneovim-10c5434f9c1219d480fd07e711838e22dc912bba.tar.bz2 rneovim-10c5434f9c1219d480fd07e711838e22dc912bba.zip | |
vim-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)
https://github.com/vim/vim/commit/db51730df1817fc4b6ecf5a065c69fac518ad821
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_functions.vim | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index 7822507f86..da5edbaea1 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -186,6 +186,29 @@ func Test_strftime() call assert_fails('call strftime([])', 'E730:') call assert_fails('call strftime("%Y", [])', 'E745:') + + " Check that the time changes after we change the timezone + " Save previous timezone value, if any + if exists('$TZ') + let tz = $TZ + endif + + " Force EST and then UTC, save the current hour (24-hour clock) for each + let $TZ = 'EST' | let est = strftime('%H') + let $TZ = 'UTC' | let utc = strftime('%H') + + " Those hours should be two bytes long, and should not be the same; if they + " are, a tzset(3) call may have failed somewhere + call assert_equal(strlen(est), 2) + call assert_equal(strlen(utc), 2) + call assert_notequal(est, utc) + + " If we cached a timezone value, put it back, otherwise clear it + if exists('tz') + let $TZ = tz + else + unlet $TZ + endif endfunc func Test_resolve() |