File: ctime.3

package info (click to toggle)
manpages-pt 20040726-8
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,988 kB
  • sloc: sh: 45; makefile: 16
file content (159 lines) | stat: -rw-r--r-- 5,811 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one
.\" 
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date.  The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein.  The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\" 
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" References consulted:
.\"     Linux libc source code
.\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
.\"     386BSD man pages
.\" Modified Sat Jul 24 19:49:27 1993 by Rik Faith (faith@cs.unc.edu)
.\" Modified Fri Apr 26 12:38:55 MET DST 1996 by Martin Schulze (joey@linux.de)
.\"
.TH CTIME 3  "April 26, 1996" "BSD" "Linux Programmer's Manual"
.SH NOME
asctime, ctime, gmtime, localtime, mktime \- convertem datas e horas binrias para ASCII
.SH SINOPSE
.nf
.B #include <time.h>
.sp
.BI "char *asctime(const struct tm *" timeptr );
.sp
.BI "char *ctime(const time_t *" timep );
.sp
.BI "struct tm *gmtime(const time_t *" timep );
.sp
.BI "struct tm *localtime(const time_t *" timep );
.sp
.BI "time_t mktime(struct tm *" timeptr );
.sp
.BI "extern char *" tzname [2];
.BI "long int " timezone ;
.BI "extern int " daylight ;
.fi
.SH DESCRIO
As funes \fBctime()\fP, \fBgmtime()\fP e \fBlocaltime()\fP recebem um
argumento tipo \fItime_t\fP, que representa um ponto no tempo. Quando
interpretado como um valor absoluto, representa o nmero de segundos desde
as 00:00:00 de 1 de janeiro de 1970 (Hora Universal Sincronizada - UTC).
.PP
As funes \fBasctime()\fP e \fBmktime()\fP recebem um argumento que representa
um instante definido em termos de ano, ms, dia, etc. Este argumento  uma
struct \fItm\fP (definida em \fI<time.h>\fP) que contm:
.sp
.RS
.nf
.ne 12
.ta 8n 16n 32n
struct tm
{
	int	tm_sec;			/* segundos */
	int	tm_min;			/* minuto */
	int	tm_hour;		/* horas */
	int	tm_mday;		/* dia do ms */
	int	tm_mon;			/* ms */
	int	tm_year;		/* ano */
	int	tm_wday;		/* dia da semana */
	int	tm_yday;		/* dia do ano */
	int	tm_isdst;		/* horrio de vero */
};
.ta
.fi
.RE
.PP
Os componentes do struct \fItm\fP so
.TP
.I tm_sec
Segundos aps o minuto. Normalmente de 0 a 59, mas podendo chegar a 61
no caso de um segundo ser acrescentado.
.TP
.I tm_min
Minutos depois da hora. De 0 a 59.
.TP
.I tm_hour
Horas aps a meia noite. De 0 a 23.
.TP
.I tm_mday
Dia do ms. De 1 a 31.
.TP
.I tm_mon
Meses desde janeiro. De 0 a 11.
.TP
.I tm_year
Anos desde 1900.
.TP
.I tm_wday
Dias de semana desde domingo. De 0 a 6.
.TP
.I tm_yday
Dias desde 1 de janeiro. De 0 a 365.
.TP
.I tm_isdst
Um flag que indica se se est em vigncia do horrio de vero.  um valor
positivo se estiver, zero se no estiver e negativo se esta informao no
estiver disponvel.
.PP
A funo \fBctime()\fP converte \fItimep\fP numa string no formato
.sp
.RS
"Wed Jun 30 21:49:08 1993\\n"
.RE
.sp
As abreviaturas dos dias da semana so `Sun', `Mon', `Tue', `Wed', `Thu',
`Fri' e `Sat',e as dos meses so `Jan', `Feb', `Mar', `Apr', `May', `Jun',
`Jul', `Aug', `Sep', `Oct', `Nov' e
`Dec'.  O valor retornado aponta para uma string alocada estaticamente, e que
pode ser sobrescrita por chamadas subseqentes a quaisquer das funes de data
e hora. A funo tambm coloca informao sobre o fuso horrio atual na varivel
externa \fItzname\fP.
.PP
A funo \fBgmtime()\fP converte o instante \fItimep\fP para a representao
detalhada do UTC.
.PP
A funo \fBlocaltime()\fP converte o instante \fItimep\fP para a representao
detalhada UTC, mas corrigida para o fuso horrio do usurio. Esta funo coloca
informaes de fuso horrio na varivel externa \fItzname\fP, a diferena entre a
UTC e a hora local em segundos em \fItimezone\fP e um valor diferente de zero em 
\fIdaylight\fP se o horrio de vero estiver em vigor.
.PP
A funo \fBasctime()\fP converte o valor de tempo \fItimeptr\fP para uma string
com o mesmo formato que \fBctime()\fP. O valor retornado aponta para uma string
alocada estaticamente que pode ser sobrescrita por chamadas subseqentes a quaisquer
das funes de data e tempo.
.PP
A funo \fBmktime()\fP converte uma struct de tempo detalhada, definida como hora 
local, para um ponto no tempo. Esta funo ignora \fItm_wday\fP e \fItm_yday\fP,
recalculando-os a partir dos outros dados no struct. Os membros sero recalculados se 
excederem seus valores mximos (ex. 40 de outubro mudar para 9 de novembro). Uma chamada
a \fBmktime()\fP tambm colocar informaes sobre o fuso horrio em \fItzname\fP. Se o
tempo especificado no puder ser representado no calendrio (em segundos desde a poca),
\fBmktime()\fP retornar (time_t)(\-1) sem alterar os componentes \fItm_wday\fP e 
\fItm_yday\fP do struct.

.SH "DE ACORDO COM"
SVID 3, POSIX, BSD 4.3, ISO 9899
.SH "VER TAMBM"
.BR date "(1), " gettimeofday "(2), " time "(2), " tzset (3),
.BR difftime (3),
.BR strftime (3),
.BR newctime (3)
.SH TRADUZIDO POR LDP-BR em 21/08/2000.
\&\fR\&\f(CWPaulo Csar Mendes <drpc@ism.com.br> (traduo)\fR
\&\fR\&\f(CWxxxxxxxxxxxxxxxxxxxxxxxxx <xxx@xxxxxx.xxx.xx> (reviso)\fR