mirror of
https://frontier.innolan.net/rainlance/amiga-tz.git
synced 2026-05-07 03:57:05 +00:00
first crack at corrected version
SCCS-file: newstrftime.3 SCCS-SID: 7.3
This commit is contained in:
committed by
Paul Eggert
parent
b4c9a8e72a
commit
f41edde406
211
newstrftime.3
211
newstrftime.3
@@ -1,3 +1,4 @@
|
||||
.\" Based on the UCB file whose copyright information appears below.
|
||||
.\" Copyright (c) 1989, 1991 The Regents of the University of California.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
@@ -36,167 +37,169 @@
|
||||
.\" from: @(#)strftime.3 5.12 (Berkeley) 6/29/91
|
||||
.\" $Id: strftime.3,v 1.4 1993/12/15 20:33:00 jtc Exp $
|
||||
.\"
|
||||
.Dd June 29, 1991
|
||||
.Dt STRFTIME 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm strftime
|
||||
.Nd format date and time
|
||||
.Sh SYNOPSIS
|
||||
.Fd #include <time.h>
|
||||
.Ft size_t
|
||||
.Fn strftime "char *buf" "size_t maxsize" "const char *format" "const struct tm *timeptr"
|
||||
.Sh DESCRIPTION
|
||||
.TH STRFTIME 3
|
||||
.SH NAME
|
||||
strftime \- format date and time
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <sys/types.h>
|
||||
.B #include <time.h>
|
||||
.PP
|
||||
.B size_t strftime(buf, maxsize, format, timeptr)
|
||||
.B char *buf;
|
||||
.B size_t maxsize;
|
||||
.B const char *format;
|
||||
.B const struct tm *timeptr"
|
||||
.PP
|
||||
.B cc ... -lz
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.Fn strftime
|
||||
.I strftime\^
|
||||
function formats the information from
|
||||
.Fa timeptr
|
||||
.I timeptr\^
|
||||
into the buffer
|
||||
.Fa buf
|
||||
.I buf\^
|
||||
according to the string pointed to by
|
||||
.Fa format .
|
||||
.Pp
|
||||
.IR format\^ .
|
||||
.PP
|
||||
The
|
||||
.Fa format
|
||||
.I format\^
|
||||
string consists of zero or more conversion specifications and
|
||||
ordinary characters.
|
||||
All ordinary characters are copied directly into the buffer.
|
||||
A conversion specification consists of a percent sign
|
||||
.Ql %
|
||||
and one other character.
|
||||
.Pp
|
||||
.PP
|
||||
No more than
|
||||
.Fa maxsize
|
||||
characters will be placed into the array.
|
||||
.I maxsize\^
|
||||
characters are be placed into the array.
|
||||
If the total number of resulting characters, including the terminating
|
||||
null character, is not more than
|
||||
.Fa maxsize ,
|
||||
.Fn strftime
|
||||
.IR maxsize\^ ,
|
||||
.I strftime\^
|
||||
returns the number of characters in the array, not counting the
|
||||
terminating null.
|
||||
Otherwise, zero is returned.
|
||||
.Pp
|
||||
.PP
|
||||
Each conversion specification is replaced by the characters as
|
||||
follows which are then copied into the buffer.
|
||||
.Bl -tag -width "xxxx"
|
||||
.It Cm \&%A
|
||||
.TP
|
||||
%A
|
||||
is replaced by the locale's full weekday name.
|
||||
.It Cm %a
|
||||
.TP
|
||||
%a
|
||||
is replaced by the locale's abbreviated weekday name.
|
||||
.It Cm \&%B
|
||||
.TP
|
||||
%B
|
||||
is replaced by the locale's full month name.
|
||||
.It Cm \&%b No or Cm \&%h
|
||||
.TP
|
||||
%b or %h
|
||||
is replaced by the locale's abbreviated month name.
|
||||
.It Cm \&%C
|
||||
.TP
|
||||
%C
|
||||
is replaced by the century (a year divided by 100 and truncated to an integer)
|
||||
as a decimal number (00-99).
|
||||
.It Cm \&%c
|
||||
.TP
|
||||
%c
|
||||
is replaced by the locale's appropriate date and time representation.
|
||||
.It Cm \&%D
|
||||
is replaced by the date in the format
|
||||
.Dq Li %m/%d/%y .
|
||||
.It Cm \&%d
|
||||
.TP
|
||||
%D
|
||||
is replaced by the date in the format %m/%d/%y.
|
||||
.TP
|
||||
%d
|
||||
is replaced by the day of the month as a decimal number (01-31).
|
||||
.It Cm \&%e
|
||||
.TP
|
||||
%e
|
||||
is replaced by the day of month as a decimal number (1-31);
|
||||
single digits are preceded by a blank.
|
||||
.It Cm \&%H
|
||||
.TP
|
||||
%H
|
||||
is replaced by the hour (24-hour clock) as a decimal number (00-23).
|
||||
.It Cm \&%I
|
||||
.TP
|
||||
%I
|
||||
is replaced by the hour (12-hour clock) as a decimal number (01-12).
|
||||
.It Cm \&%j
|
||||
.TP
|
||||
%j
|
||||
is replaced by the day of the year as a decimal number (001-366).
|
||||
.It Cm \&%k
|
||||
.TP
|
||||
%k
|
||||
is replaced by the hour (24-hour clock) as a decimal number (0-23);
|
||||
single digits are preceded by a blank.
|
||||
.It Cm \&%l
|
||||
.TP
|
||||
%l
|
||||
is replaced by the hour (12-hour clock) as a decimal number (1-12);
|
||||
single digits are preceded by a blank.
|
||||
.It Cm \&%M
|
||||
.TP
|
||||
%M
|
||||
is replaced by the minute as a decimal number (00-59).
|
||||
.It Cm %m
|
||||
.TP
|
||||
%m
|
||||
is replaced by the month as a decimal number (01-12).
|
||||
.It Cm %n
|
||||
.TP
|
||||
%n
|
||||
is replaced by a newline.
|
||||
.It Cm %p
|
||||
is replaced by the locale's equivalent of either
|
||||
.Dq Tn AM
|
||||
or
|
||||
.Dq Tn PM .
|
||||
.It Cm \&%R
|
||||
is replaced by the time in the format
|
||||
.Dq Li %H:%M .
|
||||
.It Cm \&%r
|
||||
.TP
|
||||
%p
|
||||
is replaced by the locale's equivalent of either AM or PM.
|
||||
.TP
|
||||
%R
|
||||
is replaced by the time in the format %H:%M.
|
||||
.TP
|
||||
%r
|
||||
is replaced by the locale's representation of 12-hour clock time
|
||||
using AM/PM notation.
|
||||
.It Cm \&%T
|
||||
is replaced by the time in the format
|
||||
.Dq Li %H:%M:%S .
|
||||
.It Cm \&%t
|
||||
.TP
|
||||
%T
|
||||
is replaced by the time in the format %H:%M:%S.
|
||||
.TP
|
||||
%t
|
||||
is replaced by a tab.
|
||||
.It Cm \&%S
|
||||
.TP
|
||||
%S
|
||||
is replaced by the second as a decimal number (00-60).
|
||||
.It Cm %s
|
||||
is replaced by the number of seconds since the Epoch, UCT (see
|
||||
.Xr mktime 3 ) .
|
||||
.It Cm \&%U
|
||||
.TP
|
||||
%s
|
||||
is replaced by the number of seconds since the Epoch, UCT (see mktime(3)).
|
||||
.TP
|
||||
%U
|
||||
is replaced by the week number of the year (Sunday as the first day of
|
||||
the week) as a decimal number (00-53).
|
||||
.It Cm \&%u
|
||||
.TP
|
||||
%u
|
||||
is replaced by the weekday (Monday as the first day of the week)
|
||||
as a decimal number (1-7).
|
||||
.It Cm \&%V
|
||||
.TP
|
||||
%V
|
||||
is replaced by the week number of the year (Monday as the first day of
|
||||
the week) as a decimal number (01-53). If the week containing January
|
||||
1 has four or more days in the new year, then it is week 1; otherwise
|
||||
it is week 53 of the previous year, and the next week is week 1.
|
||||
.It Cm \&%W
|
||||
.TP
|
||||
%W
|
||||
is replaced by the week number of the year (Monday as the first day of
|
||||
the week) as a decimal number (00-53).
|
||||
.It Cm \&%w
|
||||
.TP
|
||||
%w
|
||||
is replaced by the weekday (Sunday as the first day of the week)
|
||||
as a decimal number (0-6).
|
||||
.It Cm \&%X
|
||||
.TP
|
||||
%X
|
||||
is replaced by the locale's appropriate date representation.
|
||||
.It Cm \&%x
|
||||
.TP
|
||||
%x
|
||||
is replaced by the locale's appropriate time representation.
|
||||
.It Cm \&%Y
|
||||
.TP
|
||||
%Y
|
||||
is replaced by the year with century as a decimal number.
|
||||
.It Cm \&%y
|
||||
.TP
|
||||
%y
|
||||
is replaced by the year without century as a decimal number (00-99).
|
||||
.It Cm \&%Z
|
||||
.TP
|
||||
%Z
|
||||
is replaced by the time zone name.
|
||||
.It Cm %%
|
||||
is replaced by
|
||||
.Ql % .
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr date 1 ,
|
||||
.Xr ctime 3 ,
|
||||
.Xr printf 1 ,
|
||||
.Xr printf 3
|
||||
.Sh STANDARDS
|
||||
The
|
||||
.Fn strftime
|
||||
function
|
||||
conforms to
|
||||
.St -ansiC .
|
||||
The
|
||||
.Ql \&%C ,
|
||||
.Ql \&%D ,
|
||||
.Ql \&%e ,
|
||||
.Ql \&%h ,
|
||||
.Ql \&%k ,
|
||||
.Ql \&%l ,
|
||||
.Ql \&%n ,
|
||||
.Ql \&%r ,
|
||||
.Ql \&%R ,
|
||||
.Ql \&%s .
|
||||
.Ql \&%t ,
|
||||
.Ql \&%T ,
|
||||
.Ql \&%u ,
|
||||
and
|
||||
.Ql \&%V
|
||||
conversion specifications are extensions.
|
||||
.Sh BUGS
|
||||
There is no conversion specification for the phase of the moon.
|
||||
.TP
|
||||
%%
|
||||
is replaced by a single %.
|
||||
.\" %W%
|
||||
|
||||
Reference in New Issue
Block a user