diff options
author | Eric Andersen <andersen@codepoet.org> | 2004-10-11 20:52:16 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2004-10-11 20:52:16 +0000 |
commit | 9315842242f18e3c5cf706b2bb349757928b2b40 (patch) | |
tree | 55f84605486d6b9652e59ad35cd16c2509c9db1e /coreutils | |
parent | 62e0037d2d626f539502821509f0d24b589fbca0 (diff) | |
download | busybox-w32-9315842242f18e3c5cf706b2bb349757928b2b40.tar.gz busybox-w32-9315842242f18e3c5cf706b2bb349757928b2b40.tar.bz2 busybox-w32-9315842242f18e3c5cf706b2bb349757928b2b40.zip |
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.
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/date.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/coreutils/date.c b/coreutils/date.c index 26251c37b..3608df69f 100644 --- a/coreutils/date.c +++ b/coreutils/date.c | |||
@@ -47,6 +47,7 @@ | |||
47 | static struct tm *date_conv_time(struct tm *tm_time, const char *t_string) | 47 | static struct tm *date_conv_time(struct tm *tm_time, const char *t_string) |
48 | { | 48 | { |
49 | int nr; | 49 | int nr; |
50 | char *cp; | ||
50 | 51 | ||
51 | nr = sscanf(t_string, "%2d%2d%2d%2d%d", &(tm_time->tm_mon), | 52 | nr = sscanf(t_string, "%2d%2d%2d%2d%d", &(tm_time->tm_mon), |
52 | &(tm_time->tm_mday), &(tm_time->tm_hour), &(tm_time->tm_min), | 53 | &(tm_time->tm_mday), &(tm_time->tm_hour), &(tm_time->tm_min), |
@@ -56,6 +57,14 @@ static struct tm *date_conv_time(struct tm *tm_time, const char *t_string) | |||
56 | bb_error_msg_and_die(bb_msg_invalid_date, t_string); | 57 | bb_error_msg_and_die(bb_msg_invalid_date, t_string); |
57 | } | 58 | } |
58 | 59 | ||
60 | cp = strchr(t_string, '.'); | ||
61 | if (cp) { | ||
62 | nr = sscanf(cp + 1, "%2d", &(tm_time->tm_sec)); | ||
63 | if (nr != 1) { | ||
64 | bb_error_msg_and_die(bb_msg_invalid_date, t_string); | ||
65 | } | ||
66 | } | ||
67 | |||
59 | /* correct for century - minor Y2K problem here? */ | 68 | /* correct for century - minor Y2K problem here? */ |
60 | if (tm_time->tm_year >= 1900) { | 69 | if (tm_time->tm_year >= 1900) { |
61 | tm_time->tm_year -= 1900; | 70 | tm_time->tm_year -= 1900; |