File: gettimeofday.2

package info (click to toggle)
manpages-fr 0.8-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 5,760 kB
  • ctags: 4
  • sloc: makefile: 57; sh: 8
file content (209 lines) | stat: -rw-r--r-- 5,897 bytes parent folder | download
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
.\" Hey Emacs! This file is -*- nroff -*- source.
.\"
.\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992
.\"
.\" 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.
.\"
.\" Modified by Michael Haardt (u31b3hs@pool.informatik.rwth-aachen.de)
.\" Modified Fri Jul 23 21:26:27 1993 by Rik Faith (faith@cs.unc.edu)
.\" Modified 21 Aug 1994 by Michael Chastain (mec@shell.portal.com):
.\"   Fixed necessary '#include' lines.
.\" Modified 15 Apr 1995 by Michael Chastain (mec@shell.portal.com):
.\"   Added reference to adjtimex.
.\" Removed some nonsense lines pointed out by urs@isnogud.escape.de (Urs Thuermann),
.\"   aeb, 950722.
.\"
.\" 
.\" Traduction  10/10/1996 Christophe BLAESS (ccb@club-internet.fr)
.\" Mise a jour 23/01/97
.\" Mise a jour 8/04/97
.\" Mise a jour 28/04/98 (LDP-man-pages-1.19)
.TH GETTIMEOFDAY 2 "28 Avril 1998" "Linux" "Manuel du programmeur Linux"
.SH NOM
gettimeofday, settimeofday \- Lire / crire l'heure actuelle.
.SH SYNOPSIS
.B #include <sys/time.h>
.br
.B #include <unistd.h>
.sp
.BI "int gettimeofday(struct timeval *" tv ", struct timezone *" tz );
.br
.BI "int settimeofday(const struct timeval *" tv
.BI ", const struct timezone *" tz );
.SH DESCRIPTION
.B gettimeofday
et
.B settimeofday
peuvent programmer l'heure ainsi que le fuseau horaire (timezone).
.I tv
est une structure
.B timeval 
dcrite dans /usr/include/sys/time.h :
.sp
.nf
struct timeval {
.in +8
int	tv_sec;		/* secondes */
int	tv_usec;	/* microsecondes */
};
.in -8
.fi
.PP
.sp
et
.I tz
est une structure 
.B timezone 
dcrite egalement dans /usr/include/sys/time.h:
.sp
.nf
struct timezone {
.in +8
int	tz_minuteswest; /* minutes west of Greenwich  */
int	tz_dsttime;     /* type de changement horaire */
};
.in -8
.fi
.PP
L'utilisation de la structure timezone est obsolte, le champ
.I tz_dsttime
n'a jamais t utilis sous Linux, il n'a jamais t gr, et
ne le sera jamais par la libc ou glibc.
Toute occurrence de ce champ dans les sources du noyau (sauf
pour les dclarations) est un bug. Ainsi le paragraphe suivant
n'a qu'un intrt historique.

Le champ
.I tz_dsttime
contient une constante symbolique (dont les valeurs sont fournies
ci-dessous) qui indique quelle partie du changement horaire annuel
est en cours.
(Remarque : Cette valeur est constante tout au long de l'anne, elle
n'indique pas rellement la valeur horaire en cours, elle slectionne
un algorithme).
Les changements horaires (Daylight saving - DST) sont
dfinis comme suit :
.PP
\fBDST_NONE\fP    /* Aucun */
.br
\fBDST_USA\fP     /* USA */
.br
\fBDST_AUST\fP    /* Australie */
.br
\fBDST_WET\fP     /* Europe occidentale */
.br
\fBDST_MET\fP     /* Europe centrale */
.br
\fBDST_EET\fP     /* Europe Orientale */
.br
\fBDST_CAN\fP     /* Canada */
.br
\fBDST_GB\fP      /* Grande Bretagne et Irlande */
.br
\fBDST_RUM\fP     /* Roumanie */
.br
\fBDST_TUR\fP     /* Turkie */
.br
\fBDST_AUSTALT\fP /* Australie avec dcalage en 1986 */
.PP
Il est vident que le dcallage horaire en cours ne peut pas
tre uniquement fourni par un algorithme par pays. Ce dcallage
dpend de dcisions politiques imprvisibles. Ainsi cette mthode
des fuseaux horaires a t abandonne.
Sous Linux, durant un appel 
.B settimeofday
le champ
.I tz_dsttime
doit tre nul.
.PP
Sous Linux, il existe une smantique particulire associe  l'appel
systme
.B settimeofday
si, durant la premire invocation (aprs le boot), il a un argument
.I tz
non-NULL, un argument
.I tv
NULL et un champ
.I tz_minuteswest
diffrent de zro. Dans ce cas, on suppose que l'horloge CMOS de la
machine est configure sur le temps local, et que l'on doit l'augmenter
de cette valeur pour obtenir le temps UTC.
Bien entendu, il faut viter autant que possible d'utiliser cette particularit.
.PP
Les macros suivantes permettent de manipuler les
structures timeval :
.br
.nf
#define	timerisset(tvp)\\
.ti +8
((tvp)->tv_sec || (tvp)->tv_usec)
indique si le timer est non-nul.
.sp
#define	timercmp(tvp, uvp, cmp)\\
.in +8
((tvp)->tv_sec cmp (uvp)->tv_sec ||\\
(tvp)->tv_sec == (uvp)->tv_sec &&\\
(tvp)->tv_usec cmp (uvp)->tv_usec)
compare deux timers.
.sp
.in -8
#define timerclear(tvp)\\
.ti +8
((tvp)->tv_sec = (tvp)->tv_usec = 0)
efface un timer
.fi
.PP
Si
.I tv
ou 
.I tz
est nulle, la structure correspondante n'est ni programme ni renvoye.
.PP
Seul le Super\-User peut appeler
.BR settimeofday .
.SH "VALEUR RENVOYE"
.B gettimeofday
et
.B settimeofday
renvoient 0 s'ils russissent, ou -1 s'ils chouent, auquel
cas
.I errno
contient le code d'erreur.
.SH ERREURS
.TP
.B EPERM 
.B settimeofday
est appel par quelqu'un d'autre que le Super\-User
.TP
.B EINVAL
le fuseau horaire est invalide.
.B EFAULT
.I tv
ou
.I tz
pointent en dehors de l'espace d'adressage autoris.
.SH "CONFORMIT"
SVr4, BSD 4.3
.SH "VOIR AUSSI"
.BR date "(1), " adjtimex "(2), " time "(2), " ctime "(3), " ftime "(3)"

.SH TRADUCTION
Christophe Blaess, 1997.