about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2015-07-03 22:59:27 +0200
committerOliver Kiddle <opk@zsh.org>2015-07-03 22:59:27 +0200
commita257525afc1578ff4d951e6771b2afab181ac46e (patch)
tree2c34a6599c1c9b7fd5a9df586c743fb72c41ed1d
parentacb05d1616328e634c6f9914167b12c75619e828 (diff)
downloadzsh-a257525afc1578ff4d951e6771b2afab181ac46e.tar.gz
zsh-a257525afc1578ff4d951e6771b2afab181ac46e.tar.xz
zsh-a257525afc1578ff4d951e6771b2afab181ac46e.zip
35681: fix day of month initialisation
-rw-r--r--ChangeLog2
-rw-r--r--Src/Modules/datetime.c4
2 files changed, 5 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index c592fabb0..f20af3669 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2015-07-03  Oliver Kiddle  <opk@zsh.org>
 
+	* 35681: Src/Modules/datetime.c: fix day of month initialisation
+
 	* 35674: Src/Zle/zle_main.c: make an undo event for
 	initial buffer contents
 
diff --git a/Src/Modules/datetime.c b/Src/Modules/datetime.c
index 63a04dc89..d9416679f 100644
--- a/Src/Modules/datetime.c
+++ b/Src/Modules/datetime.c
@@ -53,10 +53,12 @@ reverse_strftime(char *nam, char **argv, char *scalar, int quiet)
      * to use the current timezone.  This is probably the best guess;
      * it's the one that will cause dates and times output by strftime
      * without the -r option and without an explicit timezone to be
-     * converted back correctly.
+     * converted back correctly. Additionally, tm_mday is set to 1
+     * as that and not 0 corresponds to the first of the month.
      */
     (void)memset(&tm, 0, sizeof(tm));
     tm.tm_isdst = -1;
+    tm.tm_mday = 1;
     endp = strptime(argv[1], argv[0], &tm);
 
     if (!endp) {