aboutsummaryrefslogtreecommitdiff
path: root/ja_JP.eucJP/man/man9/inittodr.9
blob: d7f198c06ff7da0d967940b58054c75cf89bb38d (plain) (blame)
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
.\"	%NetBSD: inittodr.9,v 1.2 1996/03/27 21:16:06 jtc Exp %
.\"
.\" Copyright (c) 1994 Christopher G. Demetriou
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"      This product includes software developed by Christopher G. Demetriou
.\"      for the NetBSD Project.
.\" 3. The name of the author may not be used to endorse or promote products
.\"    derived from this software without specific prior written permission
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" %FreeBSD: src/share/man/man9/inittodr.9,v 1.4.2.1 2000/12/08 14:59:20 ru Exp %
.\"
.Dd March 22, 1997
.Dt INITTODR 9
.Os FreeBSD
.Sh 名称
.Nm inittodr
.Nd システムタイムの初期化
.Sh 書式
.Fd #include <sys/types.h>
.Fd #include <sys/systm.h>
.Ft void
.Fn inittodr "time_t base"
.Sh 解説
.Fn inittodr
関数は時刻を決定しシステムクロックの設定を行います。
システムのバッテリバックアップクロックおよび
.Fa base
で与えられるルートファイルシステムから得られる時刻
を検査する発見方法を使用して正しい時刻の取得を試みます。
.Fa base
の値を得る方法は、ルートファイルシステムのタイプに依存して変化するでしょう。
下記の発見方法が使用されます。
.Bl -bullet
.It
バッテリバックアップクロックが妥当な時刻であれば、これが使用されます。
.\" .It
.\" If the battery-backed clock does not have a valid time, and 
.\" the time provided in
.\" .Fa base
.\" is within reason,
.\" .Fa base
.\" is used as the current time.
.\" .It
.\" If the battery-backed clock appears invalid, and
.\" .Fa base
.\" appears non-sensical or was not provided (was given as zero),
.\" a arbitrary base (typically some time in the late 1970s)
.\" will be used.
.It
バッテリバックアップクロックが妥当な時刻でなければ、
.Fa base
で与えられた時刻が使用されます。
.El
.Pp
一度システムタイムが決定されると、これが
.Va time
変数に格納されます。
.Sh 診断
システムタイムの計算に問題があった場合は、
.Fn inittodr
関数は診断メッセージを出力します。
出力される診断メッセージには下記の状態が含まれます。
.Bl -bullet
.It
バッテリバックアップクロックが無意味のようである。
.\" .It
.\" The
.\" .Fa base
.\" time appears nonsensical.
.\" .It
.\" The
.\" .Fa base
.\" time and the battery-backed clock's time differ by a large amount.
.El
.Sh 関連項目
.Xr resettodr 9 ,
.Xr time 9
.Sh バグ
多くのシステムで
.Fn inittodr
は、
年、月、日、時、分、秒で表現される時刻から、秒で表現される
.Va time
に変換しなければなりません。
多くの実装ではコードの共有が可能ですが、共有していません。
.Pp
それぞれのシステムの正確な時刻取得のための発見方法は、わずかに異なります。
.Pp
.Fx
の実装は、
バッテリバックアップクロックを使用できない場合は、
.Fa base 
で与えられた時刻をもっとうまく検証するべきでしょう。
現在は無条件にシステムタイムをこの値に設定します。