[Midnightbsd-cvs] src: bin/date: Add extensions to the standard to the man page.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Jun 29 22:45:42 EDT 2008


Log Message:
-----------
Add extensions to the standard to the man page.

Don't reset DST computed by strptime()

Obtained from: FreeBSD

Modified Files:
--------------
    src/bin/date:
        date.1 (r1.2 -> r1.3)
        date.c (r1.2 -> r1.3)

-------------- next part --------------
Index: date.c
===================================================================
RCS file: /home/cvs/src/bin/date/date.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L bin/date/date.c -L bin/date/date.c -u -r1.2 -r1.3
--- bin/date/date.c
+++ bin/date/date.c
@@ -187,8 +187,10 @@
 	const char *dot, *t;
 	int century;
 
+	lt = localtime(&tval);
+	lt->tm_isdst = -1;		/* divine correct DST */
+
 	if (fmt != NULL) {
-		lt = localtime(&tval);
 		t = strptime(p, fmt, lt);
 		if (t == NULL) {
 			fprintf(stderr, "Failed conversion of ``%s''"
@@ -209,8 +211,6 @@
 			badformat();
 		}
 
-		lt = localtime(&tval);
-
 		if (dot != NULL) {			/* .ss */
 			dot++; /* *dot++ = '\0'; */
 			if (strlen(dot) != 2)
@@ -265,9 +265,6 @@
 		}
 	}
 
-	/* Let mktime() decide whether summer time is in effect. */
-	lt->tm_isdst = -1;
-
 	/* convert broken-down time to GMT clock time */
 	if ((tval = mktime(lt)) == -1)
 		errx(1, "nonexistent time");
Index: date.1
===================================================================
RCS file: /home/cvs/src/bin/date/date.1,v
retrieving revision 1.2
retrieving revision 1.3
diff -L bin/date/date.1 -L bin/date/date.1 -u -r1.2 -r1.3
--- bin/date/date.1
+++ bin/date/date.1
@@ -33,7 +33,7 @@
 .\" $FreeBSD: src/bin/date/date.1,v 1.72 2005/02/13 22:25:09 ru Exp $
 .\" $MidnightBSD$
 .\"
-.Dd August 9, 2004
+.Dd June 29, 2008
 .Dt DATE 1
 .Os
 .Sh NAME
@@ -405,6 +405,7 @@
 .Xr timed 8
 fails.
 .Sh SEE ALSO
+.Xr locale 1 ,
 .Xr gettimeofday 2 ,
 .Xr strftime 3 ,
 .Xr strptime 3 ,
@@ -420,6 +421,11 @@
 .Nm
 utility is expected to be compatible with
 .St -p1003.2 .
+The
+.Fl d , f , j , n , r , t ,
+and
+.Fl v
+options are all extensions to the standard.
 .Sh HISTORY
 A
 .Nm


More information about the Midnightbsd-cvs mailing list