[BusyBox-cvs] CVS busybox/coreutils

CVS User andersen andersen at codepoet.org
Mon Oct 11 20:52:17 UTC 2004


Update of /var/cvs/busybox/coreutils
In directory nail:/tmp/cvs-serv11252/coreutils

Modified Files:
	date.c 
Log Message:
Patch from David Daney:

It seems that date  -s MMDDHHMMYYYY.ss

will ignore the .ss part.  This patch tries to fix the problem.

David Daney.


--- /var/cvs/busybox/coreutils/date.c	2004/04/14 17:51:09	1.47
+++ /var/cvs/busybox/coreutils/date.c	2004/10/11 20:52:16	1.48
@@ -47,6 +47,7 @@
 static struct tm *date_conv_time(struct tm *tm_time, const char *t_string)
 {
 	int nr;
+	char *cp;
 
 	nr = sscanf(t_string, "%2d%2d%2d%2d%d", &(tm_time->tm_mon),
 				&(tm_time->tm_mday), &(tm_time->tm_hour), &(tm_time->tm_min),
@@ -56,6 +57,14 @@
 		bb_error_msg_and_die(bb_msg_invalid_date, t_string);
 	}
 
+	cp = strchr(t_string, '.');
+	if (cp) {
+		nr = sscanf(cp + 1, "%2d", &(tm_time->tm_sec));
+		if (nr != 1) {
+			bb_error_msg_and_die(bb_msg_invalid_date, t_string);
+		}
+	}
+
 	/* correct for century  - minor Y2K problem here? */
 	if (tm_time->tm_year >= 1900) {
 		tm_time->tm_year -= 1900;



More information about the busybox-cvs mailing list