File: gettimeofday.2

package info (click to toggle)
manpages-es 0.4a-2
  • links: PTS
  • area: main
  • in suites: hamm, slink
  • size: 3,592 kB
  • ctags: 3
  • sloc: sh: 59; makefile: 42
file content (173 lines) | stat: -rw-r--r-- 4,422 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
.\" 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.
.\" Modified 14 Jan 1997 by Austin Donnelly (and1000@debian.org):
.\"   Added return values section, and bit on EFAULT
.\" Translated 15 Dec 1997 by Gerardo Aburruzaga G <gerardo.aburruzaga@uca.es>
.\"
.\".TH GETTIMEOFDAY 2 "14 January 1997" "Linux 2.0.21" "LinuxProgrammer's Manual"
.TH GETTIMEOFDAY 2 "15 Diciembre 1997" "Linux 2.0.32" "Manual del Programador Linux"
.SH NOMBRE
gettimeofday, settimeofday \- pone u obtiene la hora
.SH SINOPSIS
.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 DESCRIPCIN
.B gettimeofday
y
.B settimeofday
pueden poner tanto la hora como una zona horaria.
.I tv
es una estructura
.B timeval
, tal como se especifica en /usr/include/sys/time.h:
.sp
.nf
struct timeval {
.in 22
long    tv_sec;         /* segundos */
long    tv_usec;        /* microsegundos */
};
.in 10
.fi
.PP
.sp
y 
.I tz
es una estructura 
.B timezone 
:
.sp
.nf
struct timezone {
.in 23
int     tz_minuteswest;
/* minutos al O de Greenwich */
int     tz_dsttime;
/* tipo de correccin horaria de invierno/verano */
};
.in 10
.fi
.PP
con la correccin horaria de invierno/verano definida como sigue:
.PP
.B DST_NONE
/* no hay */
.br
.B DST_USA      
/* estilo EE.UU. */
.br
.B DST_AUST     
/* estilo australiano */
.br
.B DST_WET
/* como en Europa Occidental */
.br
.B DST_MET
/* como en Europa Central */
.br
.B DST_EET
/* como en Europa del Este */
.br
.B DST_CAN
/* Canad */
.br
.B DST_GB       
/* Gran Bretaa e Irlanda */
.br
.B DST_RUM
/* Rumana */
.br
.B  DST_TUR
/* Turqua */
.br
.B DST_AUSTALT  
/* estilo australiano con cambio en 1986 */
.PP
Y para operar sobre esto se definen las siguientes macros:
.br
.nf
#define timerisset(tvp)\\
.ti 18
((tvp)->tv_sec || (tvp)->tv_usec)
#define timercmp(tvp, uvp, cmp)\\
.in 18
((tvp)->tv_sec cmp (uvp)->tv_sec ||\\
(tvp)->tv_sec == (uvp)->tv_sec &&\\
(tvp)->tv_usec cmp (uvp)->tv_usec)
.in 10
#define timerclear(tvp)\\
.ti 18
((tvp)->tv_sec = (tvp)->tv_usec = 0)
.fi
.PP
Si 
.I tv
o
.I tz
es nulo, la estructura correspondiente no se ajusta ni se devuelve.
.PP
Solamente el super-usuario puede emplear
.BR settimeofday .
.SH "VALORES DEVUELTOS"
.B getimeofday
y
.B settimeofday
devuelven 0 en caso de xito  -1 si ocurre un fallo (en cuyo caso
.I errno
toma un valor apropiado).
.SH ERRORES
.TP
.B EPERM 
Alguien que no es el super-usuario ha llamado a
.B settimeofday
.
.TP
.B EINVAL
La zona horaria (o algo ms) es invlida.
.TP
.B EFAULT
Uno de  
.I tv
o
.I tz
apuntaba afuera de su espacio de direcciones accesible. 
.SH "CONFORME CON"
SVr4, BSD 4.3
.SH "VASE TAMBIN"
.BR date "(1), " adjtimex "(2), " time "(2), " ctime "(3), " ftime "(3)"