diff options
author | Warner Losh <imp@FreeBSD.org> | 2019-03-21 06:47:23 +0000 |
---|---|---|
committer | Warner Losh <imp@FreeBSD.org> | 2019-03-21 06:47:23 +0000 |
commit | e77a99c1c15a1d81f9a47c2a7611aa8325662142 (patch) | |
tree | c6e442af51490740f2cd568eaff9eed4d1a7af2e /bin | |
parent | 1194c3cb5727aeec402eb7421f31869d897e2fcd (diff) | |
download | src-test2-e77a99c1c15a1d81f9a47c2a7611aa8325662142.tar.gz src-test2-e77a99c1c15a1d81f9a47c2a7611aa8325662142.zip |
Notes
Diffstat (limited to 'bin')
-rw-r--r-- | bin/date/date.1 | 38 | ||||
-rw-r--r-- | bin/date/date.c | 40 |
2 files changed, 22 insertions, 56 deletions
diff --git a/bin/date/date.1 b/bin/date/date.1 index d8dd72681803..bfdb26adeaee 100644 --- a/bin/date/date.1 +++ b/bin/date/date.1 @@ -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. diff --git a/bin/date/date.c b/bin/date/date.c index 10e8a126d565..7f216e484740 100644 --- a/bin/date/date.c +++ b/bin/date/date.c @@ -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, int nflag) 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 = "???"; |