File: gettimeofday.2

package info (click to toggle)
manpages-ja 0.5.0.0.20080615-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 20,508 kB
  • ctags: 1
  • sloc: sh: 13,690; perl: 157; makefile: 114
file content (248 lines) | stat: -rw-r--r-- 6,788 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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
.\" 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 (michael@moria.de)
.\" Modified 1993-07-23 by Rik Faith (faith@cs.unc.edu)
.\" Modified 1994-08-21 by Michael Chastain (mec@shell.portal.com):
.\"   Fixed necessary '#include' lines.
.\" Modified 1995-04-15 by Michael Chastain (mec@shell.portal.com):
.\"   Added reference to adjtimex.
.\" Removed some nonsense lines pointed out by Urs Thuermann,
.\"   (urs@isnogud.escape.de), aeb, 950722.
.\" Modified 1997-01-14 by Austin Donnelly (and1000@debian.org):
.\"   Added return values section, and bit on EFAULT
.\" Added clarification on timezone, aeb, 971210.
.\" Removed "#include <unistd.h>", aeb, 010316.
.\" Modified, 2004-05-27 by Michael Kerrisk <mtk.manpages@gmail.com>
.\"   Added notes on capability requirement.
.\"
.\" Japanese Version Copyright (c) 1998 HANATAKA Shinya
.\"         all rights reserved.
.\" Translated 1998-05-11, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Updated & Modified 2001-06-02, Yuichi SATO <ysato@h4.dion.ne.jp>
.\" Updated & Modified 2001-12-23, Yuichi SATO
.\" Updated & Modified 2003-09-06, Yuichi SATO <ysato444@yahoo.co.jp>
.\" Updated & Modified 2004-12-30, Yuichi SATO
.\" Updated 2006-07-23, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
.\"
.\"WORD:	timezone		ॾ
.\"WORD:	daylight savings times	ƻ(daylight savings times)
.\"WORD:	macro			ޥ
.\"WORD:	null			NULL
.\"WORD:	superuser		ѡ桼
.\"
.TH GETTIMEOFDAY 2 2007-07-27 "Linux" "Linux Programmer's Manual"
.SH ̾
gettimeofday, settimeofday \- /ꤹ
.SH 
.nf
.B #include <sys/time.h>

.BI "int gettimeofday(struct timeval *" tv ", struct timezone *" tz );

.BI "int settimeofday(const struct timeval *" tv \
", const struct timezone *" tz );

.fi
.in -4n
glibc εǽޥ׷
.RB ( feature_test_macros (7)
):
.in
.sp
.BR settimeofday ():
_BSD_SOURCE
.SH 
ؿ
.BR gettimeofday ()

.BR settimeofday ()
ϻȥॾޤꤹ롣
.I tv

.I struct timeval
Ǥ
.RI ( <sys/time.h>
Ƥ):
.sp
.in +4n
.nf
struct timeval {
    time_t      tv_sec;     /*  */
    suseconds_t tv_usec;    /* ޥ */
};
.fi
.in
.sp
ˤ굪 (the Epoch:
.BR time (2)
򻲾) äȥޥäǤ롣
.I tz

.I "struct timezone"
Ǥ:
.sp
.in +4n
.nf
struct timezone {
    int tz_minuteswest;     /* ˥åɸȤκ (ʬñ) */
    int tz_dsttime;         /* ƻĴη */
};
.fi
.in
.PP
.I tv

.I tz
 NULL ξ硢б빽¤Τ/ϹԤʤ
.\" The following is covered under EPERM below:
.\" .PP
.\" Only the superuser may use
.\" .BR settimeofday ().
.PP
.I timezone
¤ΤȤΤϻ٤ (obsolete) Ǥ:
.I tz
̾ NULL ˻ꤹ٤Ǥ롣
.I tz_dsttime
եɤ Linux ǤϰڻȤƤʤä;
libc  glibc Ǥ⥵ݡȤƤʤä
줫⥵ݡȤ뤳ȤϤʤ
ͥΥʳǡΥեɤ¸ߤΤƥХǤ롣
äƤʹߤεҤϡỤ̄˴ŤΤǤ롣

.I tz_dsttime
եɤˤ (ʲͿ褦) ܥǼ롣
ϰǯΤǤIJƻ (Daylight Savings Time) »ܤ뤫򼨤Ƥ
(: ͤǯ֤̤Ǥ:
ƻ֤»Ǥ뤳Ȥ򼨤櫓ǤϤʤ
르ꥺ򤷤ƤǤ)
ƻ֤ϰʲΤ褦:
.in +4n
.nf

\fBDST_NONE\fP     /* ƻ֤ѤƤʤ */
.br
\fBDST_USA\fP      /* ꥫ罰񼰲ƻ */
.br
\fBDST_AUST\fP     /* ȥꥢƻ */
.br
\fBDST_WET\fP      /* 衼åѼƻ */
.br
\fBDST_MET\fP      /* 衼åѼƻ */
.br
\fBDST_EET\fP      /* 衼åѼƻ */
.br
\fBDST_CAN\fP      /* ʥ */
.br
\fBDST_GB\fP       /* 졼ȥ֥ƥ󤪤ӥ */
.br
\fBDST_RUM\fP      /* 롼ޥ˥ */
.br
\fBDST_TUR\fP      /* ȥ륳 */
.br
\fBDST_AUSTALT\fP  /* 1986ǯ˰ܹԤ줿ȥꥢ */
.fi
.in
.PP
ΤȤʤ顢ƻ֤ɤδ֤˼»ܤ뤫
񤴤Ȥδñʥ르ꥺƳȤǤʤȤȽ
ºݡƻ֤δ֤ͽ¬ԲǽŪǷޤ롣
ΤᤳˡǥࡦɽȤǰ줿
Linux ˤ
.BR settimeofday ()
ƤӽФȤϡ
.I tz_dsttime
եɤ 0 ˤ٤Ǥ롣
.PP
Linux Ǥϡ
.BR settimeofday ()
ƥࡦ˴ϢơäΡ֥åΥ (warp clock)פ¸ߤ롣
 (֡ȸ) ǽθƤӽФ
.I tz
 NULL Ǥʤ
.I tv
 NULL 
.I tz_minuteswest
եɤ 0 Ǥʤ˵롣
Τ褦ʾ硢
.BR settimeofday ()
 CMOS å (local time) Ǥꡢ
UTC ƥ֤뤿ˤϡ
.I tz_minuteswest
ʬäʤƤϤʤʤȤߤʤƤޤ
ʤεȤȤɤͤǤϤʤ
.PP
.I timeval
¤Τ뤿Υޥ
.BR timeradd (3)
ˤ롣
.SH ֤
.BR gettimeofday ()

.BR settimeofday ()
 0 ֤Ԥ \-1 ֤
.I errno
Ŭڤꤵ)
.SH 顼
.TP
.B EFAULT
.I tv

.I tz
Τɤ餫ǽʥɥ쥹ֳؤƤ롣
.TP
.B EINVAL
ॾ (ޤ¾β) Ǥ롣
.TP
.B EPERM
ƤӽФץ
.BR settimeofday ()
ƤӽФνʬøʤ
Linux Ǥ
.B CAP_SYS_TIME
ѥӥƥ (capability) ɬפǤ롣
.SH 
SVr4, 4.3BSD ˽򤹤롣
POSIX.1-2001 
.BR gettimeofday ()
ˤĤƤϵҤƤ뤬
.BR settimeofday ()
ˤĤƤϵҤƤʤ
.SH 
.LP
Τ
.I struct timeval
Υեɤ
.I long
Ǥä
.SH Ϣ
.BR date (1),
.BR adjtimex (2),
.BR time (2),
.BR ctime (3),
.BR ftime (3),
.BR capabilities (7),
.BR time (7)