]> granicus.if.org Git - vim/commitdiff
patch 8.2.0949: strptime() does not use DST v8.2.0949
authorBram Moolenaar <Bram@vim.org>
Wed, 10 Jun 2020 14:54:13 +0000 (16:54 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 10 Jun 2020 14:54:13 +0000 (16:54 +0200)
Problem:    Strptime() does not use DST.
Solution:   Set the tm_isdst field to -1. (Tomáš Janoušek, closes #6230)

src/testdir/test_functions.vim
src/time.c
src/version.c

index f83264b4805e5664448e91fa7747c3fa692eecf1..0a4e94e0a729bcc91d23d9ef9f8439c7ea326a74 100644 (file)
@@ -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", ''))
index 272a5b5d3b893f8af3747b8b2110993f3bfabcc1..89ff08bdf4653f29c95babf07a20b9a7048682e5 100644 (file)
@@ -314,6 +314,7 @@ f_strptime(typval_T *argvars, typval_T *rettv)
     char_u     *enc;
 
     CLEAR_FIELD(tmval);
+    tmval.tm_isdst = -1;
     fmt = tv_get_string(&argvars[0]);
     str = tv_get_string(&argvars[1]);
 
index 20d5081579a3d5739c84ff665c7a82228ba2bc6b..52d655cbc2042839fb8913a129ef598825a9fa9e 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    949,
 /**/
     948,
 /**/