summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/touch.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/touch.c b/src/touch.c
index 671a559fb..e4666f03f 100644
--- a/src/touch.c
+++ b/src/touch.c
@@ -364,6 +364,16 @@ main (int argc, char **argv)
newtime = posixtime (argv[optind], PDS_TRAILING_YEAR);
if (newtime != (time_t) -1)
{
+ if (! getenv ("POSIXLY_CORRECT"))
+ {
+ struct tm const *tm = posixtm (argv[optind], PDS_TRAILING_YEAR);
+ error (0, 0,
+ _("warning: `touch %s' is obsolete; use `touch -t %04d%02d%02d%02d%02d.%02d'"),
+ argv[optind],
+ tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
+ tm->tm_hour, tm->tm_min, tm->tm_sec);
+ }
+
optind++;
date_set++;
}