diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-12-06 11:05:22 -0500 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-03-27 10:53:42 -0400 |
commit | a7e0b0edbc2143b4efd6beda0498ef18789a2bdf (patch) | |
tree | 0dc446fa3cc64d7d1814e9afb8b09979e5382a9e /src | |
parent | 93e9cf4b6c24945a7fda9e624b73cf8c315994e7 (diff) | |
download | rneovim-a7e0b0edbc2143b4efd6beda0498ef18789a2bdf.tar.gz rneovim-a7e0b0edbc2143b4efd6beda0498ef18789a2bdf.tar.bz2 rneovim-a7e0b0edbc2143b4efd6beda0498ef18789a2bdf.zip |
vim-patch:8.2.0949: strptime() does not use DST
Problem: Strptime() does not use DST.
Solution: Set the tm_isdst field to -1. (Tomáš Janoušek, closes vim/vim#6230)
https://github.com/vim/vim/commit/ea1233fccf4f52f2b4eaab3788a087878d1336fc
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/eval/funcs.c | 4 | ||||
-rw-r--r-- | src/nvim/testdir/test_functions.vim | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 145a7a4733..650b4e3882 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -10195,7 +10195,9 @@ static void f_strptime(typval_T *argvars, typval_T *rettv, FunPtr fptr) char fmt_buf[NUMBUFLEN]; char str_buf[NUMBUFLEN]; - struct tm tmval = { 0 }; + struct tm tmval = { + .tm_isdst = -1, + }; char *fmt = (char *)tv_get_string_buf(&argvars[0], fmt_buf); char *str = (char *)tv_get_string_buf(&argvars[1], str_buf); diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index ea75aec52c..145da3070b 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -225,6 +225,10 @@ func Test_strptime() call assert_equal(1484653763, strptime('%Y-%m-%d %T', '2017-01-17 11:49:23')) + " Force DST and check that it's considered + let $TZ = 'WINTER0SUMMER,J1,J365' + call assert_equal(1484653763 - 3600, strptime('%Y-%m-%d %T', '2017-01-17 11:49:23')) + call assert_fails('call strptime()', 'E119:') call assert_fails('call strptime("xxx")', 'E119:') call assert_equal(0, strptime("%Y", '')) |