# HG changeset patch # User Bram Moolenaar # Date 1591801204 -7200 # Node ID 2e7acc208a1fdfb38e13fc484c8649370b3e2e1c # Parent d48f8bb5f34effd22a6aa34473bd22bf12f1ba2f patch 8.2.0949: strptime() does not use DST Commit: https://github.com/vim/vim/commit/ea1233fccf4f52f2b4eaab3788a087878d1336fc Author: Bram Moolenaar Date: Wed Jun 10 16:54:13 2020 +0200 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 https://github.com/vim/vim/issues/6230) diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim --- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -280,6 +280,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", '')) diff --git a/src/time.c b/src/time.c --- a/src/time.c +++ b/src/time.c @@ -314,6 +314,7 @@ f_strptime(typval_T *argvars, typval_T * char_u *enc; CLEAR_FIELD(tmval); + tmval.tm_isdst = -1; fmt = tv_get_string(&argvars[0]); str = tv_get_string(&argvars[1]); diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -755,6 +755,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 949, +/**/ 948, /**/ 947,