[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: [PATCH] libbb: fix time parsing of [[CC]YY]MMDDhhmm[.SS]
From: Natanael Copa <ncopa () alpinelinux ! org>
Date: 2016-05-19 14:54:48
Message-ID: 1463669688-16500-1-git-send-email-ncopa () alpinelinux ! org
[Download RAW message or body]
If SS is not given a value, it is assumed to be zero.
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/touch.html
closes 8951
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
libbb/time.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libbb/time.c b/libbb/time.c
index aa19a47..44dd4aa 100644
--- a/libbb/time.c
+++ b/libbb/time.c
@@ -159,6 +159,8 @@ void FAST_FUNC parse_datestr(const char *date_str, struct tm *ptm)
&ptm->tm_hour,
&ptm->tm_min,
&end) >= 5) {
+ /* assume zero if [.SS] is not given */
+ ptm->tm_sec = 0;
/* Adjust month from 1-12 to 0-11 */
ptm->tm_mon -= 1;
if ((int)cur_year >= 50) { /* >= 1950 */
@@ -181,6 +183,8 @@ void FAST_FUNC parse_datestr(const char *date_str, struct tm *ptm)
&ptm->tm_hour,
&ptm->tm_min,
&end) >= 5) {
+ /* assume zero if [.SS] is not given */
+ ptm->tm_sec = 0;
ptm->tm_year -= 1900; /* Adjust years */
ptm->tm_mon -= 1; /* Adjust month from 1-12 to 0-11 */
} else {
--
2.8.2
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic