summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith M Wesolowski <wesolows@foobazco.org>2014-01-08 18:01:43 +0000
committerKeith M Wesolowski <wesolows@foobazco.org>2014-01-08 18:01:52 +0000
commit7e7abd4d4c78353590cf18476fa374ff2e3e7176 (patch)
treea50dc16a2f855d242ddc383f207b051c8b23d546
parent6ca718aa15285e34a516d3fae4b5f3e80a2f9240 (diff)
parentee169c7e77bc5d28a401dde8533cbd38afd24ae1 (diff)
downloadillumos-joyent-7e7abd4d4c78353590cf18476fa374ff2e3e7176.tar.gz
[illumos-gate merge]20140109release-20140109
commit ee169c7e77bc5d28a401dde8533cbd38afd24ae1 4378 Clean up %C in *time() functions 438 need documentation for strftime %s flag Conflicts: usr/src/lib/print/libpapi-common/common/attribute.c (deleted) usr/src/cmd/cron/cron.c (copyright)
-rw-r--r--usr/src/cmd/cron/cron.c7
-rw-r--r--usr/src/cmd/fruadm/fruadm.c4
-rw-r--r--usr/src/lib/libc/port/gen/cftime.c6
-rw-r--r--usr/src/lib/libfru/libnvfru/nvfru.c4
-rw-r--r--usr/src/man/man3c/strftime.3c82
5 files changed, 52 insertions, 51 deletions
diff --git a/usr/src/cmd/cron/cron.c b/usr/src/cmd/cron/cron.c
index 8edb18bca9..33a7373f1e 100644
--- a/usr/src/cmd/cron/cron.c
+++ b/usr/src/cmd/cron/cron.c
@@ -24,6 +24,7 @@
*
* Copyright 2013 Joshua M. Clulow <josh@sysmgr.org>
* Copyright 2013 Joyent, Inc. All rights reserved.
+ * Copyright (c) 2014 Gary Mills
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -551,7 +552,7 @@ begin:
} else {
ne_time = next_event->time - t;
#ifdef DEBUG
- cftime(timebuf, "%C", &next_event->time);
+ cftime(timebuf, "%+", &next_event->time);
(void) fprintf(stderr, "next_time=%ld %s\n",
next_event->time, timebuf);
#endif
@@ -625,7 +626,7 @@ begin:
next_time(next_event, (time_t)0);
}
#ifdef DEBUG
- cftime(timebuf, "%C", &next_event->time);
+ cftime(timebuf, "%+", &next_event->time);
(void) fprintf(stderr,
"pushing back cron event %s at %ld (%s)\n",
next_event->cmd, next_event->time, timebuf);
@@ -1350,7 +1351,7 @@ again:
}
cte_valid();
#ifdef DEBUG
- cftime(timebuf, "%C", &e->time);
+ cftime(timebuf, "%+", &e->time);
(void) fprintf(stderr, "inserting cron event %s at %ld (%s)\n",
e->cmd, e->time, timebuf);
#endif
diff --git a/usr/src/cmd/fruadm/fruadm.c b/usr/src/cmd/fruadm/fruadm.c
index bbf218966b..0efb6c5539 100644
--- a/usr/src/cmd/fruadm/fruadm.c
+++ b/usr/src/cmd/fruadm/fruadm.c
@@ -20,6 +20,8 @@
*/
/*
+ * Copyright (c) 2014 Gary Mills
+ *
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -172,7 +174,7 @@ displayBinary(unsigned char *data, size_t length, fru_elemdef_t *def)
char buffer[PATH_MAX];
time_t time;
time = (time_t)lldata;
- (void) strftime(buffer, PATH_MAX, "%C",
+ (void) strftime(buffer, PATH_MAX, "%+",
localtime(&time));
(void) printf("%s", buffer);
return;
diff --git a/usr/src/lib/libc/port/gen/cftime.c b/usr/src/lib/libc/port/gen/cftime.c
index f4fa872da8..be0a67c75d 100644
--- a/usr/src/lib/libc/port/gen/cftime.c
+++ b/usr/src/lib/libc/port/gen/cftime.c
@@ -20,6 +20,8 @@
*/
/*
+ * Copyright (c) 2014 Gary Mills
+ *
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -27,8 +29,6 @@
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* This routine converts time as follows. The epoch is 0000 Jan 1
* 1970 GMT. The argument time is in seconds since then. The
@@ -91,7 +91,7 @@ ascftime(char *buf, const char *format, const struct tm *tm)
/* Set format string, if not already set */
if (format == NULL || *format == '\0')
if (((format = getenv("CFTIME")) == 0) || *format == 0)
- format = "%C";
+ format = "%+";
return ((int)strftime(buf, LONG_MAX, format, tm));
}
diff --git a/usr/src/lib/libfru/libnvfru/nvfru.c b/usr/src/lib/libfru/libnvfru/nvfru.c
index 08aae7d56a..b5ed00ae4a 100644
--- a/usr/src/lib/libfru/libnvfru/nvfru.c
+++ b/usr/src/lib/libfru/libnvfru/nvfru.c
@@ -20,6 +20,8 @@
*/
/*
+ * Copyright (c) 2014 Gary Mills
+ *
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
*/
@@ -73,7 +75,7 @@ convert_field(const uint8_t *field, const fru_regdef_t *def, const char *path,
}
(void) memcpy(&timefield, field, sizeof (timefield));
timefield = BE_32(timefield);
- if (strftime(timestring, sizeof (timestring), "%C",
+ if (strftime(timestring, sizeof (timestring), "%c",
localtime(&timefield)) == 0) {
/* buffer too small */
return;
diff --git a/usr/src/man/man3c/strftime.3c b/usr/src/man/man3c/strftime.3c
index 4d73366ae5..f2b8eff328 100644
--- a/usr/src/man/man3c/strftime.3c
+++ b/usr/src/man/man3c/strftime.3c
@@ -1,4 +1,5 @@
'\" te
+.\" Copyright (c) 2014 Gary Mills
.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 1989 AT&T
.\" Portions Copyright (c) 1992, X/Open Company Limited. All Rights Reserved.
@@ -9,7 +10,7 @@
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH STRFTIME 3C "Sep 5, 2006"
+.TH STRFTIME 3C "Jan 3, 2014"
.SH NAME
strftime, cftime, ascftime \- convert date and time to string
.SH SYNOPSIS
@@ -50,7 +51,7 @@ that overlap, the behavior is undefined. For \fBstrftime()\fR, no more than
.LP
If \fIformat\fR is \fB(char *)0\fR, then the locale's default format is used.
For \fBstrftime()\fR the default format is the same as \fB%c\fR; for
-\fBcftime()\fR and \fBascftime()\fR the default format is the same as \fB%C\fR.
+\fBcftime()\fR and \fBascftime()\fR the default format is the same as \fB%+\fR.
\fBcftime()\fR and \fBascftime()\fR first try to use the value of the
environment variable \fBCFTIME\fR, and if that is undefined or empty, the
default format is used.
@@ -107,59 +108,24 @@ Locale's abbreviated month name.
Locale's full month name.
.RE
-.SS "Default"
.sp
.ne 2
.na
\fB\fB%c\fR\fR
.ad
.RS 6n
-Locale's appropriate date and time represented as:
-.sp
-.in +2
-.nf
-%a %b %d %H:%M:%S %Y
-.fi
-.in -2
-
-This is the default behavior as well as standard-conforming behavior for
-standards first supported by releases prior to Solaris 2.4. See
-\fBstandards\fR(5).
-.RE
-
-.SS "Standard conforming"
-.sp
-.ne 2
-.na
-\fB\fB%c\fR\fR
-.ad
-.RS 6n
-Locale's appropriate date and time represented as:
+Locale's appropriate date and time representation.
+In the C locale, this format is:
.sp
.in +2
.nf
%a %b %e %H:%M:%S %Y
.fi
.in -2
-
-This is standard-conforming behavior for standards first supported by Solaris
-2.4 through Solaris 10.
-.RE
-
-.SS "Default"
-.sp
-.ne 2
-.na
-\fB\fB%C\fR\fR
-.ad
-.RS 6n
-Locale's date and time representation as produced by \fBdate\fR(1).
.sp
-This is the default behavior as well as standard-conforming behavior for
-standards first supported by releases prior to Solaris 2.4.
+Other locales may have different locale-specific formats.
.RE
-.SS "Standard conforming"
.sp
.ne 2
.na
@@ -168,9 +134,6 @@ standards first supported by releases prior to Solaris 2.4.
.RS 6n
Century number (the year divided by 100 and truncated to an integer as a
decimal number [01,99]).
-.sp
-This is standard-conforming behavior for standards first supported by Solaris
-2.4 through Solaris 10.
.RE
.sp
@@ -339,6 +302,15 @@ Time as \fB%H\fR:\fB%M\fR.
.sp
.ne 2
.na
+\fB\fB%s\fR\fR
+.ad
+.RS 6n
+Seconds since 00:00:00 UTC, January 1, 1970.
+.RE
+
+.sp
+.ne 2
+.na
\fB\fB%S\fR\fR
.ad
.RS 6n
@@ -387,6 +359,15 @@ of week 1.
.sp
.ne 2
.na
+\fB\fB%v\fR\fR
+.ad
+.RS 6n
+Date as \fB%e\fR-\fB%b\fR-\fB%Y\fR.
+.RE
+
+.sp
+.ne 2
+.na
\fB\fB%V\fR\fR
.ad
.RS 6n
@@ -476,6 +457,15 @@ Time zone name or abbreviation, or no bytes if no time zone information exists.
.RE
.sp
+.ne 2
+.na
+\fB\fB%+\fR\fR
+.ad
+.RS 6n
+Locale's date and time representation as produced by \fBdate\fR(1).
+.RE
+
+.sp
.LP
If a conversion specification does not correspond to any of the above or to any
of the modified conversion specifications listed below, the behavior is
@@ -788,3 +778,9 @@ This change was based on the XPG4 specification.
If using the \fB%Z\fR specifier and \fBzoneinfo\fR timezones and if the input
date is outside the range 20:45:52 UTC, December 13, 1901 to 03:14:07 UTC,
January 19, 2038, the timezone name may not be correct.
+.sp
+.LP
+The conversion specification for \fB%+\fR was added in illumos.
+It is not part of any standard, although it is available on a number
+of other platforms.
+Its use is discouraged for conforming applications.