date,touch: treat 2-digit years better (fit them into +-50 yrs around today)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko committed 2011-01-02 20:02:09 +01:00
1 parent a5d3d3436b
commit 92ffe0571a
2 files changed
+16 -3

No files matched your search

+4 -3
View File
@@ -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 */