diff options
| author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2004-10-11 20:52:16 +0000 |
|---|---|---|
| committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2004-10-11 20:52:16 +0000 |
| commit | 3486e083178d17a482a4a43a1d9dfa9a8eb08657 (patch) | |
| tree | 55f84605486d6b9652e59ad35cd16c2509c9db1e /coreutils | |
| parent | 55f283cd6a5ce08974be8eccaf869778e4607580 (diff) | |
| download | busybox-w32-3486e083178d17a482a4a43a1d9dfa9a8eb08657.tar.gz busybox-w32-3486e083178d17a482a4a43a1d9dfa9a8eb08657.tar.bz2 busybox-w32-3486e083178d17a482a4a43a1d9dfa9a8eb08657.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.
git-svn-id: svn://busybox.net/trunk/busybox@9406 69ca8d6d-28ef-0310-b511-8ec308f3f277
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; |
