Print this page
Garrett's man page edits.

Split Close
Expand all
Collapse all
          --- old/usr/src/man/man3c/strftime.3c
          +++ new/usr/src/man/man3c/strftime.3c
   1    1  '\" te
        2 +.\" Copyright 2014 Garrett D'Amore <garrett@damore.org>
   2    3  .\" Copyright (c) 2014 Gary Mills
   3    4  .\" Copyright (c) 2008, Sun Microsystems, Inc.  All Rights Reserved.
   4    5  .\" Copyright 1989 AT&T
   5    6  .\" Portions Copyright (c) 1992, X/Open Company Limited.  All Rights Reserved.
   6    7  .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
   7    8  .\" http://www.opengroup.org/bookstore/.
   8    9  .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
   9   10  .\"  This notice shall appear on any product containing this material.
  10   11  .\" 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.
  11   12  .\" 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.
  12   13  .\" 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]
  13      -.TH STRFTIME 3C "Jan 3, 2014"
       14 +.TH STRFTIME 3C "Jun 24, 2014"
  14   15  .SH NAME
  15   16  strftime, strftime_l cftime, ascftime \- convert date and time to string
  16   17  .SH SYNOPSIS
  17   18  .LP
  18   19  .nf
  19   20  #include <time.h>
  20   21  
  21   22  \fBsize_t\fR \fBstrftime\fR(\fBchar *restrict\fR \fIs\fR, \fBsize_t\fR \fImaxsize\fR,
  22   23       \fBconst char *restrict\fR \fIformat\fR,
  23   24       \fBconst struct tm *restrict\fR \fItimeptr\fR);
       25 +.fi
       26 +.LP
       27 +.nf
  24   28  \fBsize_t\fR \fBstrftime_l\fR(\fBchar *restrict\fR \fIs\fR, \fBsize_t\fR \fImaxsize\fR,
  25   29       \fBconst char *restrict\fR \fIformat\fR,
  26   30       \fBconst struct tm *restrict\fR \fItimeptr\fR, \fBlocale_t\fR \fIloc\fR);
  27   31  .fi
  28      -
  29   32  .LP
  30   33  .nf
  31   34  \fBint\fR \fBcftime\fR(\fBchar *\fR\fIs\fR, \fBchar *\fR\fIformat\fR, \fBconst time_t *\fR\fIclock\fR);
  32   35  .fi
  33      -
  34   36  .LP
  35   37  .nf
  36   38  \fBint\fR \fBascftime\fR(\fBchar *\fR\fIs\fR, \fBconst char *\fR\fIformat\fR,
  37   39       \fBconst struct tm *\fR\fItimeptr\fR);
  38   40  .fi
  39   41  
  40   42  .SH DESCRIPTION
  41   43  .sp
  42   44  .LP
  43      -The \fBstrftime()\fR, \fBascftime()\fR, and \fBcftime()\fR functions place
       45 +The \fBstrftime()\fR, \fBstrftime_l()\fR, \fBascftime()\fR, and \fBcftime()\fR
       46 +functions place
  44   47  bytes into the array pointed to by \fIs\fR as controlled by the string pointed
  45   48  to by \fIformat\fR. The \fIformat\fR string consists of zero or more conversion
  46   49  specifications and ordinary characters.  A conversion specification consists of
  47   50  a '\fB%\fR' (percent) character and one or two terminating conversion
  48   51  characters that determine the conversion specification's behavior.  All
  49   52  ordinary characters (including the terminating null byte) are copied unchanged
  50   53  into the array pointed to by \fIs\fR. If copying takes place between objects
  51   54  that overlap, the behavior is undefined. For \fBstrftime()\fR, no more than
  52   55  \fImaxsize\fR bytes are placed into the array. The \fBstrftime_l()\fR function
  53   56  behaves identically to \fBstrftime()\fR function, but instead of operating in
  54   57  the current locale, it operates in the locale specified by \fIloc\fR.
  55      -.sp
  56   58  .LP
  57   59  If \fIformat\fR is \fB(char *)0\fR, then the locale's default format is used.
  58   60  For \fBstrftime()\fR the default format is the same as \fB%c\fR; for
  59   61  \fBcftime()\fR and \fBascftime()\fR the default format is the same as \fB%+\fR.
  60   62  \fBcftime()\fR and \fBascftime()\fR first try to use the value of the
  61   63  environment variable \fBCFTIME\fR, and if that is undefined or empty, the
  62   64  default format is used.
  63      -.sp
  64   65  .LP
  65   66  Each conversion specification is replaced by appropriate characters as
  66   67  described in the following list. The appropriate characters are determined by
  67   68  the \fBLC_TIME\fR category of the program's locale and by the values contained
  68   69  in the structure pointed to by \fItimeptr\fR for \fBstrftime()\fR and
  69   70  \fBascftime()\fR, and by the time represented by \fIclock\fR for
  70   71  \fBcftime()\fR.
  71   72  .sp
  72   73  .ne 2
  73   74  .na
↓ open down ↓ 389 lines elided ↑ open up ↑
 463  464  
 464  465  .sp
 465  466  .ne 2
 466  467  .na
 467  468  \fB\fB%+\fR\fR
 468  469  .ad
 469  470  .RS 6n
 470  471  Locale's date and time representation as produced by \fBdate\fR(1).
 471  472  .RE
 472  473  
 473      -.sp
 474  474  .LP
 475  475  If a conversion specification does not correspond to any of the above or to any
 476  476  of the modified conversion specifications listed below, the behavior is
 477  477  undefined and \fB0\fR is returned.
 478      -.sp
 479  478  .LP
 480  479  The difference between \fB%U\fR and \fB%W\fR (and also between modified
 481  480  conversion specifications \fB%OU\fR and \fB%OW\fR) lies in which day is counted
 482  481  as the first of the week. Week number 1 is the first week in January starting
 483  482  with a Sunday for \fB%U\fR or a Monday for \fB%W\fR. Week number 0 contains
 484  483  those days before the first Sunday or Monday in January for \fB%U\fR and
 485  484  \fB%W\fR, respectively.
 486  485  .SS "Modified Conversion Specifications"
 487      -.sp
 488  486  .LP
 489  487  Some conversion specifications can be modified by the \fBE\fR and \fBO\fR
 490  488  modifiers to indicate that an alternate format or specification should be used
 491  489  rather than the one normally used by the unmodified conversion specification.
 492  490  If the alternate format or specification does not exist in the current locale,
 493  491  the behavior will be as if the unmodified specification were used.
 494  492  .sp
 495  493  .ne 2
 496  494  .na
 497  495  \fB\fB%Ec\fR\fR
↓ open down ↓ 181 lines elided ↑ open up ↑
 679  677  .ne 2
 680  678  .na
 681  679  \fB\fB%Oy\fR\fR
 682  680  .ad
 683  681  .RS 7n
 684  682  Year (offset from \fB%C\fR) in the locale's alternate representation and using
 685  683  the locale's alternate numeric symbols.
 686  684  .RE
 687  685  
 688  686  .SS "Selecting the Output Language"
 689      -.sp
 690  687  .LP
 691      -By default, the output of \fBstrftime()\fR, \fBcftime()\fR, and
 692      -\fBascftime()\fR appear in U.S. English. The user can request that the output
 693      -of \fBstrftime()\fR, \fBcftime()\fR, or \fBascftime()\fR be in a specific
 694      -language by setting the \fBLC_TIME\fR category using \fBsetlocale()\fR.
      688 +These routines produce output that is formatted according to the \fBLC_TIME\fR
      689 +locale category.  They use either the current locale, or in the case of
      690 +\fBstrftime_l()\fR, the locale supplied by \fIloc\fR.
 695  691  .SS "Time Zone"
 696      -.sp
 697  692  .LP
 698  693  Local time zone information is used as though \fBtzset\fR(3C) were called.
 699  694  .SH RETURN VALUES
 700      -.sp
 701  695  .LP
 702      -The \fBstrftime()\fR, \fBcftime()\fR, and \fBascftime()\fR functions return the
      696 +These functions return the
 703  697  number of characters placed into the array pointed to by \fIs\fR, not including
 704  698  the terminating null character. If the total number of resulting characters
 705  699  including the terminating null character is more than \fImaxsize\fR,
 706  700  \fBstrftime()\fR returns \fB0\fR and the contents of the array are
 707  701  indeterminate.
 708  702  .SH EXAMPLES
 709  703  .LP
 710  704  \fBExample 1 \fRAn example of the \fBstrftime()\fR function.
 711      -.sp
 712  705  .LP
 713  706  The following example illustrates the use of \fBstrftime()\fR for the
 714  707  \fBPOSIX\fR locale. It shows what the string in \fIstr\fR would look like if
 715  708  the structure pointed to by \fItmptr\fR contains the values corresponding to
 716  709  Thursday, August 28, 1986 at 12:44:36.
 717      -
 718      -.sp
 719      -.in +2
 720  710  .nf
 721      -\fBstrftime (str, strsize, "%A %b %d %j", tmptr)\fR
      711 +.IP
      712 +\fBstrftime\fR(\fIstr\fR, \fIstrsize\fR, "%A %b %d %j", \fItmptr\fR);
 722  713  .fi
 723      -.in -2
 724      -
 725      -.sp
 726  714  .LP
 727  715  This results in \fIstr\fR containing "Thursday Aug 28 240".
 728      -
 729  716  .SH ATTRIBUTES
 730      -.sp
 731  717  .LP
 732  718  See \fBattributes\fR(5) for descriptions of the following attributes:
 733      -.sp
 734      -
 735      -.sp
 736  719  .TS
 737  720  box;
 738  721  c | c
 739  722  l | l .
 740  723  ATTRIBUTE TYPE  ATTRIBUTE VALUE
 741  724  _
 742  725  CSI     Enabled
 743  726  _
 744      -Interface Stability     Committed
      727 +Interface Stability     See below.
 745  728  _
 746  729  MT-Level        MT-Safe
 747  730  _
 748  731  Standard        See below.
 749  732  .TE
 750  733  
 751      -.sp
 752  734  .LP
 753      -For \fBstrftime()\fR, see \fBstandards\fR(5).
      735 +The \fBstrftime()\fR and \fBstrftime_l()\fR functions are Standard.
      736 +\fBcftime()\fR and \fBascftime()\fR functions are Committed.
      737 +.LP
      738 +For \fBstrftime()\fR and \fBstrftime_l()\fR, see \fBstandards\fR(5).
 754  739  .SH SEE ALSO
 755      -.sp
 756  740  .LP
 757      -\fBdate\fR(1), \fBctime\fR(3C), \fBmktime\fR(3C), \fBsetlocale\fR(3C),
 758      -\fBstrptime\fR(3C), \fBtzset\fR(3C), \fBTIMEZONE\fR(4), \fBzoneinfo\fR(4),
      741 +\fBdate\fR(1), \fBctime\fR(3C), \fBmktime\fR(3C),
      742 +\fBnewlocale\fR(3C), \fBsetlocale\fR(3C), \fBstrptime\fR(3C), \fBtzset\fR(3C),
      743 +\fBuselocale\fR(3C), \fBTIMEZONE\fR(4), \fBzoneinfo\fR(4),
 759  744  \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)
 760  745  .SH NOTES
 761      -.sp
 762  746  .LP
 763  747  The conversion specification for \fB%V\fR was changed in the Solaris 7 release.
 764  748  This change was based on the public review draft of the ISO C9x standard at
 765  749  that time. Previously, the specification stated that if the week containing 1
 766  750  January had fewer than four days in the new year, it became week 53 of the
 767  751  previous year. The ISO C9x standard committee subsequently recognized that that
 768  752  specification had been incorrect.
 769      -.sp
 770  753  .LP
 771  754  The conversion specifications for \fB%g\fR, \fB%G\fR, \fB%Eg\fR, \fB%EG\fR, and
 772  755  \fB%Og\fR were added in the Solaris 7 release.  This change was based on the
 773      -public review draft of the ISO C9x standard at that time. These specifications
 774      -are evolving.  If the ISO C9x standard is finalized with a different
 775      -conclusion, these specifications will change to conform to the ISO C9x standard
 776      -decision.
 777      -.sp
      756 +public review draft of the ISO C9x standard at that time. The \fB%g\fR and
      757 +\fB%G\fR specifications were adopted in the formal standard.  The other two
      758 +were not, and should not be used in portable applications.
 778  759  .LP
 779  760  The conversion specification for \fB%u\fR was changed in the Solaris 8 release.
 780  761  This change was based on the XPG4 specification.
 781      -.sp
 782  762  .LP
 783  763  If using the \fB%Z\fR specifier and \fBzoneinfo\fR timezones and if the input
 784  764  date is outside the range 20:45:52 UTC, December  13, 1901 to 03:14:07 UTC,
 785  765  January 19, 2038, the timezone name may not be correct.
 786      -.sp
 787  766  .LP
 788  767  The conversion specification for \fB%+\fR was added in illumos.
 789  768  It is not part of any standard, although it is available on a number
 790  769  of other platforms.
 791  770  Its use is discouraged for conforming applications.
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX