From 671146c3b41460ec3ad25f64f1269be0f3924b27 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 4 Jul 2015 03:49:53 -0500 Subject: Actually set time with touch -d and -t when you don't specify nanonseconds. There's a nanoseconds field value that says use current time, which I set but forgot to clear in the right places. (Oops.) --- toys/posix/touch.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'toys/posix/touch.c') diff --git a/toys/posix/touch.c b/toys/posix/touch.c index c5ebbabf..052448ba 100644 --- a/toys/posix/touch.c +++ b/toys/posix/touch.c @@ -62,6 +62,7 @@ void touch_main(void) localtime_r(&(ts->tv_sec), &tm); } s = strptime(date, "%Y-%m-%dT%T", &tm); + ts->tv_nsec = 0; if (s && *s=='.' && isdigit(s[1])) sscanf(s, ".%lu%n", &ts->tv_nsec, &len); else len = 0; @@ -79,6 +80,7 @@ void touch_main(void) if (s) break; toybuf[1]='y'; } + ts->tv_nsec = 0; if (s && *s=='.' && sscanf(s, ".%2u%n", &(tm.tm_sec), &len) == 1) { sscanf(s += len, "%lu%n", &ts->tv_nsec, &len); len++; -- cgit v1.2.3