From owner-svn-src-all@freebsd.org Thu Mar 21 06:47:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6DA371553BC4; Thu, 21 Mar 2019 06:47:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E47F673104; Thu, 21 Mar 2019 06:47:23 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ADB014FD3; Thu, 21 Mar 2019 06:47:23 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2L6lNWt045458; Thu, 21 Mar 2019 06:47:23 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2L6lNb6045456; Thu, 21 Mar 2019 06:47:23 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201903210647.x2L6lNb6045456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 21 Mar 2019 06:47:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345365 - head/bin/date X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/bin/date X-SVN-Commit-Revision: 345365 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E47F673104 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 06:47:24 -0000 Author: imp Date: Thu Mar 21 06:47:23 2019 New Revision: 345365 URL: https://svnweb.freebsd.org/changeset/base/345365 Log: Remove -n flag, fix setting date / time r342139 bork setting the date. This fixes it by simply removing the -n flag. Differential Revision: https://reviews.freebsd.org/D19668 Modified: head/bin/date/date.1 head/bin/date/date.c Modified: head/bin/date/date.1 ============================================================================== --- head/bin/date/date.1 Thu Mar 21 06:31:14 2019 (r345364) +++ head/bin/date/date.1 Thu Mar 21 06:47:23 2019 (r345365) @@ -32,7 +32,7 @@ .\" @(#)date.1 8.3 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd March 12, 2019 +.Dd March 20, 2019 .Dt DATE 1 .Os .Sh NAME @@ -52,13 +52,13 @@ .Ar ... .Op Cm + Ns Ar output_fmt .Nm -.Op Fl jnu +.Op Fl ju .Sm off .Op Oo Oo Oo Oo Ar cc Oc Ar yy Oc Ar mm Oc Ar dd Oc Ar HH .Ar MM Op Ar .ss .Sm on .Nm -.Op Fl jnRu +.Op Fl jRu .Fl f Ar input_fmt new_date .Op Cm + Ns Ar output_fmt .Nm @@ -142,16 +142,6 @@ This allows you to use the flag in addition to the .Cm + option to convert one date format to another. -.It Fl n -By default, if the -.Xr timed 8 -daemon is running, -.Nm -sets the time on all of the machines in the local group. -The -.Fl n -option suppresses this behavior and causes the time to be set only on the -current machine. .It Fl R Use RFC 2822 date and time output format. This is equivalent to using @@ -431,23 +421,6 @@ can be used to parse the output from .Nm and express it in Epoch time. .Sh DIAGNOSTICS -Occasionally, when -.Xr timed 8 -synchronizes the time on many hosts, the setting of a new time value may -require more than a few seconds. -On these occasions, -.Nm -prints: -.Ql Network time being set . -The message -.Ql Communication error with timed -occurs when the communication -between -.Nm -and -.Xr timed 8 -fails. -.Pp It is invalid to combine the .Fl I flag with either @@ -465,8 +438,7 @@ and exits with an error status. .Xr gettimeofday 2 , .Xr getutxent 3 , .Xr strftime 3 , -.Xr strptime 3 , -.Xr timed 8 +.Xr strptime 3 .Rs .%T "TSP: The Time Synchronization Protocol for UNIX 4.3BSD" .%A R. Gusella @@ -478,7 +450,7 @@ The utility is expected to be compatible with .St -p1003.2 . The -.Fl d , f , I , j , n , r , t , +.Fl d , f , I , j , r , t , and .Fl v options are all extensions to the standard. Modified: head/bin/date/date.c ============================================================================== --- head/bin/date/date.c Thu Mar 21 06:31:14 2019 (r345364) +++ head/bin/date/date.c Thu Mar 21 06:47:23 2019 (r345365) @@ -72,7 +72,7 @@ static void iso8601_usage(const char *); static void multipleformats(void); static void printdate(const char *); static void printisodate(struct tm *); -static void setthetime(const char *, const char *, int, int); +static void setthetime(const char *, const char *, int); static void usage(void); static const struct iso8601_fmt { @@ -92,7 +92,7 @@ int main(int argc, char *argv[]) { int ch, rflag; - bool Iflag, jflag, nflag, Rflag; + bool Iflag, jflag, Rflag; const char *format; char buf[1024]; char *fmt; @@ -107,8 +107,8 @@ main(int argc, char *argv[]) fmt = NULL; (void) setlocale(LC_TIME, ""); rflag = 0; - Iflag = jflag = nflag = Rflag = 0; - while ((ch = getopt(argc, argv, "f:I::jnRr:uv:")) != -1) + Iflag = jflag = Rflag = 0; + while ((ch = getopt(argc, argv, "f:I::jRr:uv:")) != -1) switch((char)ch) { case 'f': fmt = optarg; @@ -132,9 +132,6 @@ main(int argc, char *argv[]) case 'j': jflag = 1; /* don't set time */ break; - case 'n': /* don't set network */ - nflag = 1; - break; case 'R': /* RFC 2822 datetime format */ if (Iflag) multipleformats(); @@ -179,7 +176,7 @@ main(int argc, char *argv[]) } if (*argv) { - setthetime(fmt, *argv, jflag, nflag); + setthetime(fmt, *argv, jflag); ++argv; } else if (fmt != NULL) usage(); @@ -250,7 +247,7 @@ printisodate(struct tm *lt) #define ATOI2(s) ((s) += 2, ((s)[-2] - '0') * 10 + ((s)[-1] - '0')) static void -setthetime(const char *fmt, const char *p, int jflag, int nflag) +setthetime(const char *fmt, const char *p, int jflag) { struct utmpx utx; struct tm *lt; @@ -343,20 +340,17 @@ setthetime(const char *fmt, const char *p, int jflag, errx(1, "nonexistent time"); if (!jflag) { - /* set the time */ - if (nflag) { - utx.ut_type = OLD_TIME; - memset(utx.ut_id, 0, sizeof(utx.ut_id)); - (void)gettimeofday(&utx.ut_tv, NULL); - pututxline(&utx); - tv.tv_sec = tval; - tv.tv_usec = 0; - if (settimeofday(&tv, NULL) != 0) - err(1, "settimeofday (timeval)"); - utx.ut_type = NEW_TIME; - (void)gettimeofday(&utx.ut_tv, NULL); - pututxline(&utx); - } + utx.ut_type = OLD_TIME; + memset(utx.ut_id, 0, sizeof(utx.ut_id)); + (void)gettimeofday(&utx.ut_tv, NULL); + pututxline(&utx); + tv.tv_sec = tval; + tv.tv_usec = 0; + if (settimeofday(&tv, NULL) != 0) + err(1, "settimeofday (timeval)"); + utx.ut_type = NEW_TIME; + (void)gettimeofday(&utx.ut_tv, NULL); + pututxline(&utx); if ((p = getlogin()) == NULL) p = "???";