diff options
author | Rob Landley <rob@landley.net> | 2015-07-04 03:49:53 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2015-07-04 03:49:53 -0500 |
commit | 671146c3b41460ec3ad25f64f1269be0f3924b27 (patch) | |
tree | 4715c6a272a9441d809a17b09243ac14e8c87cb8 /toys | |
parent | 0ace882af7b6b26dc1932a6aaa19c245a83765bc (diff) | |
download | toybox-671146c3b41460ec3ad25f64f1269be0f3924b27.tar.gz |
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.)
Diffstat (limited to 'toys')
-rw-r--r-- | toys/posix/touch.c | 2 |
1 files changed, 2 insertions, 0 deletions
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++; |