- /*
- * If no -r or -t flag, at least two operands, the first of which
- * is an 8 or 10 digit number, use the obsolete time specification.
- */
- if (!timeset && argc > 1) {
- (void)strtol(argv[0], &p, 10);
- len = p - argv[0];
- if (*p == '\0' && (len == 8 || len == 10)) {
- timeset = 1;
- stime_arg2(*argv++, len == 10, tv);
+ if (timeset) {
+ if (Aflag) {
+ /*
+ * We're setting the time to an offset from a specified
+ * time. God knows why, but it means that we can set
+ * that time once and for all here.
+ */
+ if (aflag)
+ ts_struct.atime.tv_sec += Aflag;
+ if (mflag)
+ ts_struct.mtime.tv_sec += Aflag;
+ Aflag = 0; /* done our job */
+ }
+ } else {
+ /*
+ * If no -r or -t flag, at least two operands, the first of
+ * which is an 8 or 10 digit number, use the obsolete time
+ * specification, otherwise use the current time.
+ */
+ if (argc > 1) {
+ strtol(argv[0], &p, 10);
+ len = p - argv[0];
+ if (*p == '\0' && (len == 8 || len == 10)) {
+ timeset = 1;
+ stime_arg2(*argv++, len == 10, &ts_struct);
+ }