summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorDenys Vlasenko2011-01-02 20:02:09 +0100
committerDenys Vlasenko2011-01-02 20:02:09 +0100
commit92ffe0571a49077f06fc65bf0ada753b30fd8a53 (patch)
tree706e3cd2aeb23ddfece91b6f9612e272070d3e44 /coreutils
parenta5d3d3436b16bf6e1a92ed969e171ac812e8f906 (diff)
downloadbusybox-92ffe0571a49077f06fc65bf0ada753b30fd8a53.zip
busybox-92ffe0571a49077f06fc65bf0ada753b30fd8a53.tar.gz
date,touch: treat 2-digit years better (fit them into +-50 yrs around today)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/touch.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/coreutils/touch.c b/coreutils/touch.c
index 3521771..6c2b948 100644
--- a/coreutils/touch.c
+++ b/coreutils/touch.c
@@ -120,9 +120,10 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
struct tm tm_time;
time_t t;
- //time(&t);
- //localtime_r(&t, &tm_time);
- memset(&tm_time, 0, sizeof(tm_time));
+ //memset(&tm_time, 0, sizeof(tm_time));
+ /* Better than memset: makes "HH:MM" dates meaningful */
+ time(&t);
+ localtime_r(&t, &tm_time);
parse_datestr(date_str, &tm_time);
/* Correct any day of week and day of year etc. fields */