Time-Piece-1.08 >
1.20
との差分
Time::Piece 1.20 と 1.08 の差分
1 | 1 | |
2 | 2 | =encoding euc-jp |
3 | 3 | |
4 | =head1 | |
4 | =head1 名前 | |
5 | 5 | |
6 | =begin original | |
7 | ||
8 | Time::Piece - Object Oriented time objects | |
9 | ||
10 | =end original | |
11 | ||
12 | 6 | Time::Piece - オブジェクト指向な時間オブジェクト |
13 | 7 | |
14 | =head1 | |
8 | =head1 概要 | |
15 | 9 | |
16 | 10 | use Time::Piece; |
17 | 11 | |
18 | 12 | my $t = localtime; |
19 | 13 | print "Time is $t\n"; |
20 | 14 | print "Year is ", $t->year, "\n"; |
21 | 15 | |
22 | =head1 | |
16 | =head1 説明 | |
23 | 17 | |
24 | =begin original | |
25 | ||
26 | 18 | This module replaces the standard localtime and gmtime functions with |
27 | 19 | implementations that return objects. It does so in a backwards |
28 | 20 | compatible manner, so that using localtime/gmtime in the way documented |
29 | 21 | in perlfunc will still return what you expect. |
30 | 22 | |
31 | ||
23 | このモジュールは、標準の localtime と gmtime 関数を、オブジェクトを返す実装のものに置き換えます。 | |
24 | 後方互換性があるので、perlfunc に書かれているように、localtime/gmtime を使っても、期待通りのものを返します。 | |
32 | 25 | |
33 | このモジュールは、標準の localtime と gmtime 関数を、オブジェクトを返す | |
34 | 実装のものに置き換えます。 | |
35 | これを後方互換性がある形で行うので、perlfunc に書かれているように | |
36 | localtime/gmtime を使っても、期待通りのものを返します。 | |
37 | ||
38 | =begin original | |
39 | ||
40 | 26 | The module actually implements most of an interface described by |
41 | 27 | Larry Wall on the perl5-porters mailing list here: |
42 | 28 | http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-01/msg00241.html |
43 | 29 | |
44 | ||
30 | このモジュールは、実際に、Larry Wall が、perl5-portersメーリングリストに書いた、 | |
31 | ほとんどのインターフェースを実装します: | |
46 | このモジュールは、Larry Wall が perl5-porters メーリングリストに書いた、 | |
47 | インターフェースのほとんどを実際に実装します: | |
48 | 32 | http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-01/msg00241.html |
49 | 33 | |
50 | =head1 | |
34 | =head1 使い方 | |
51 | 35 | |
52 | (使い方) | |
53 | ||
54 | =begin original | |
55 | ||
56 | 36 | After importing this module, when you use localtime or gmtime in a scalar |
57 | 37 | context, rather than getting an ordinary scalar string representing the |
58 | 38 | date and time, you get a Time::Piece object, whose stringification happens |
59 | 39 | to produce the same effect as the localtime and gmtime functions. There is |
60 | 40 | also a new() constructor provided, which is the same as localtime(), except |
61 | 41 | when passed a Time::Piece object, in which case it's a copy constructor. The |
62 | 42 | following methods are available on the object: |
63 | 43 | |
64 | ||
44 | このモジュールをインポートした後は、スカラコンテキストで、localtime か、gmtime を使うと、 | |
45 | 日付と時間を表現する普通のスカラ文字列ではなくて、Time::Pieceオブジェクトを得ます。 | |
66 | ||
46 | Time::Pieceオブジェクトの stringification は、localtime と gmtime たまたま関数と同じ効果があります。 | |
67 | ||
47 | new() コンストラクタもありますが、Time::Pieceオブジェクトが渡されない限りlocaltime()と同じです。 | |
68 | Time::Piece | |
48 | Time::Pieceオブジェクトが渡されると、コピーするコンストラクタになります。 | |
69 | Time::Piece オブジェクトの文字列化は、偶然にも localtime と gmtime 関数と | |
70 | 同じ効果があります。 | |
71 | new() コンストラクタもありますが、Time::Piece オブジェクトが渡されない限り | |
72 | localtime() と同じです。 | |
73 | Time::Piece オブジェクトが渡されると、コピーコンストラクタになります。 | |
74 | 49 | 下記のメソッドがオブジェクトで利用できます: |
75 | 50 | |
76 | =begin original | |
77 | ||
78 | $t->sec # also available as $t->second | |
79 | $t->min # also available as $t->minute | |
80 | $t->hour # 24 hour | |
81 | $t->mday # also available as $t->day_of_month | |
82 | $t->mon # 1 = January | |
83 | $t->_mon # 0 = January | |
84 | $t->monname # Feb | |
85 | $t->month # same as $t->monname | |
86 | $t->fullmonth # February | |
87 | $t->year # based at 0 (year 0 AD is, of course 1 BC) | |
88 | $t->_year # year minus 1900 | |
89 | $t->yy # 2 digit year | |
90 | $t->wday # 1 = Sunday | |
91 | $t->_wday # 0 = Sunday | |
92 | $t->day_of_week # 0 = Sunday | |
93 | $t->wdayname # Tue | |
94 | $t->day # same as wdayname | |
95 | $t->fullday # Tuesday | |
96 | $t->yday # also available as $t->day_of_year, 0 = Jan 01 | |
97 | $t->isdst # also available as $t->daylight_savings | |
98 | ||
99 | $t->hms # 12:34:56 | |
100 | $t->hms(".") # 12.34.56 | |
101 | $t->time # same as $t->hms | |
102 | ||
103 | $t->ymd # 2000-02-29 | |
104 | $t->date # same as $t->ymd | |
105 | $t->mdy # 02-29-2000 | |
106 | $t->mdy("/") # 02/29/2000 | |
107 | $t->dmy # 29-02-2000 | |
108 | $t->dmy(".") # 29.02.2000 | |
109 | $t->datetime # 2000-02-29T12:34:56 (ISO 8601) | |
110 | $t->cdate # Tue Feb 29 12:34:56 2000 | |
111 | "$t" # same as $t->cdate | |
112 | ||
113 | $t->epoch # seconds since the epoch | |
114 | $t->tzoffset # timezone offset in a Time::Seconds object | |
115 | ||
116 | $t->julian_day # number of days since Julian period began | |
117 | $t->mjd # modified Julian date (JD-2400000.5 days) | |
118 | ||
119 | $t->week # week number (ISO 8601) | |
120 | ||
121 | $t->is_leap_year # true if it its | |
122 | $t->month_last_day # 28-31 | |
123 | ||
124 | $t->time_separator($s) # set the default separator (default ":") | |
125 | $t->date_separator($s) # set the default separator (default "-") | |
126 | $t->day_list(@days) # set the default weekdays | |
127 | $t->mon_list(@days) # set the default months | |
128 | ||
129 | $t->strftime(FORMAT) # same as POSIX::strftime (without the overhead | |
130 | # of the full POSIX extension) | |
131 | $t->strftime() # "Tue, 29 Feb 2000 12:34:56 GMT" | |
132 | ||
133 | Time::Piece->strptime(STRING, FORMAT) | |
134 | # see strptime man page. Creates a new | |
135 | # Time::Piece object | |
136 | ||
137 | =end original | |
138 | ||
139 | 51 | $t->sec # $t->second も可 |
140 | 52 | $t->min # $t->minute も可 |
141 | $t->hour # 24 | |
53 | $t->hour # 24時制 | |
142 | 54 | $t->mday # $t->day_of_month も可 |
143 | 55 | $t->mon # 1 = 一月 |
144 | 56 | $t->_mon # 0 = 一月 |
145 | 57 | $t->monname # Feb |
146 | 58 | $t->month # $t->monname と同じ |
147 | 59 | $t->fullmonth # February |
148 | $t->year # 0 | |
60 | $t->year # 0始まり(AD0年は、もちろん、BC1年) | |
149 | $t->_year # 年から | |
61 | $t->_year # 年から1900引いたもの | |
150 | $t->yy # 2 | |
62 | $t->yy # 2桁の年 | |
151 | 63 | $t->wday # 1 = 日曜 |
152 | 64 | $t->_wday # 0 = 日曜 |
153 | 65 | $t->day_of_week # 0 = 日曜 |
154 | 66 | $t->wdayname # Tue |
155 | 67 | $t->day # wdayname と同じ |
156 | 68 | $t->fullday # Tuesday |
157 | $t->yday # $t->day_of_year も可, 0 = | |
69 | $t->yday # $t->day_of_year も可, 0 = Jan 01 | |
158 | 70 | $t->isdst # $t->daylight_savings も可。 |
159 | 71 | |
160 | 72 | $t->hms # 12:34:56 |
161 | 73 | $t->hms(".") # 12.34.56 |
162 | 74 | $t->time # $t->hms と同じ |
163 | 75 | |
164 | 76 | $t->ymd # 2000-02-29 |
165 | 77 | $t->date # $t->ymd と同じ |
166 | 78 | $t->mdy # 02-29-2000 |
167 | 79 | $t->mdy("/") # 02/29/2000 |
168 | 80 | $t->dmy # 29-02-2000 |
169 | 81 | $t->dmy(".") # 29.02.2000 |
170 | 82 | $t->datetime # 2000-02-29T12:34:56 (ISO 8601) |
171 | 83 | $t->cdate # Tue Feb 29 12:34:56 2000 |
172 | 84 | "$t" # $t->cdate と同じ |
173 | 85 | |
174 | 86 | $t->epoch # epochからの秒 |
175 | $t->tzoffset # Time::Seconds | |
87 | $t->tzoffset # timezone offset in a Time::Seconds object | |
176 | 88 | |
177 | 89 | $t->julian_day # ユリウス歴が始まってからの日の数 |
178 | $t->mjd # | |
90 | $t->mjd # modified Julian date (JD-2400000.5 days) | |
179 | 91 | |
180 | 92 | $t->week # 週番号 (ISO 8601) |
181 | 93 | |
182 | 94 | $t->is_leap_year # 閏年なら真を返す |
183 | 95 | $t->month_last_day # 28-31 |
184 | 96 | |
185 | $t->time_separator($s) # デフォルトのセパレータを | |
97 | $t->time_separator($s) # デフォルトのセパレータをセットします (default ":") | |
186 | $t->date_separator($s) # デフォルトのセパレータを | |
98 | $t->date_separator($s) # デフォルトのセパレータをセットします (default "-") | |
187 | $t->day_list(@days) # デフォルトの曜日を | |
99 | $t->day_list(@days) # デフォルトの曜日をセットします | |
188 | $t->mon_list(@days) # デフォルトの月名を | |
100 | $t->mon_list(@days) # デフォルトの月名をセットします | |
189 | 101 | |
190 | $t->strftime(FORMAT) # POSIX::strftime と同じ( | |
102 | $t->strftime(FORMAT) # POSIX::strftime と同じ(without the overhead | |
191 | # POSIX | |
103 | # of the full POSIX extension) | |
192 | 104 | $t->strftime() # "Tue, 29 Feb 2000 12:34:56 GMT" |
193 | 105 | |
194 | 106 | Time::Piece->strptime(STRING, FORMAT) |
195 | # strptime man ページを見て下さい | |
107 | # strptime man ページを見て下さい | |
196 | # Time::Piece | |
108 | # 新しく、Time::Piece object を作ります | |
197 | 109 | |
198 | 110 | =head2 Local Locales |
199 | 111 | |
200 | (ローカルロケール) | |
201 | ||
202 | =begin original | |
203 | ||
204 | 112 | Both wdayname (day) and monname (month) allow passing in a list to use |
205 | 113 | to index the name of the days against. This can be useful if you need |
206 | 114 | to implement some form of localisation without actually installing or |
207 | 115 | using locales. |
208 | 116 | |
209 | ||
117 | 曜日(day)と月名(month)の両方ともに、曜日のインデックスに使うリストに渡すことを | |
118 | 許しています。実際にインストールしたり、ロケールを使わずに、 | |
119 | なんらかのローカライゼーションを実装する必要があれば、有益でしょう。 | |
210 | 120 | |
211 | wdayname (day) と monname (month) の両方ともに、曜日のインデックスに使う | |
212 | リストを渡すことができます。 | |
213 | 実際にロケールをインストールしたり使ったりせずに、ある種の地域化を実装する | |
214 | 必要があるなら、有益でしょう。 | |
215 | ||
216 | 121 | my @days = qw( Dimanche Lundi Merdi Mercredi Jeudi Vendredi Samedi ); |
217 | 122 | |
218 | 123 | my $french_day = localtime->day(@days); |
219 | 124 | |
220 | =begin original | |
221 | ||
222 | 125 | These settings can be overriden globally too: |
223 | 126 | |
224 | =end original | |
225 | ||
226 | 127 | これらの設定はグローバルにもオーバーライドできます: |
227 | 128 | |
228 | 129 | Time::Piece::day_list(@days); |
229 | 130 | |
230 | =begin original | |
231 | ||
232 | 131 | Or for months: |
233 | 132 | |
234 | =end original | |
235 | ||
236 | 133 | また、月なら: |
237 | 134 | |
238 | 135 | Time::Piece::mon_list(@months); |
239 | 136 | |
240 | =begin original | |
241 | ||
242 | 137 | And locally for months: |
243 | 138 | |
244 | ||
139 | ローカルにするなら: | |
245 | 140 | |
246 | 月に関してローカルに行うなら: | |
247 | ||
248 | 141 | print localtime->month(@months); |
249 | 142 | |
250 | =head2 | |
143 | =head2 日付の演算 | |
251 | 144 | |
252 | (日付の演算) | |
253 | ||
254 | =begin original | |
255 | ||
256 | 145 | It's possible to use simple addition and subtraction of objects: |
257 | 146 | |
258 | =end original | |
259 | ||
260 | 147 | 単純なオブジェクトの足し算、引き算ができます: |
261 | 148 | |
262 | 149 | use Time::Seconds; |
263 | 150 | |
264 | 151 | my $seconds = $t1 - $t2; |
265 | 152 | $t1 += ONE_DAY; # add 1 day (constant from Time::Seconds) |
266 | 153 | |
267 | =begin original | |
268 | ||
269 | 154 | The following are valid ($t1 and $t2 are Time::Piece objects): |
270 | 155 | |
271 | ||
156 | 下記のようにx使えます($t と $t2 はTime::Piece オブジェクト): | |
272 | 157 | |
273 | 下記のものは有効です($t1 と $t2 は Time::Piece オブジェクト): | |
274 | ||
275 | 158 | $t1 - $t2; # returns Time::Seconds object |
276 | 159 | $t1 - 42; # returns Time::Piece object |
277 | 160 | $t1 + 533; # returns Time::Piece object |
278 | 161 | |
279 | =begin original | |
280 | ||
281 | 162 | However adding a Time::Piece object to another Time::Piece object |
282 | 163 | will cause a runtime error. |
283 | 164 | |
284 | ||
165 | ですが、Time::Piece オブジェクトに、別のTime::Piece オブジェクトを | |
285 | ||
286 | ですが、Time::Piece オブジェクトに別の Time::Piece オブジェクトを | |
287 | 166 | 足すのは、実行時エラーを引き起こします。 |
288 | 167 | |
289 | =begin original | |
290 | ||
291 | 168 | Note that the first of the above returns a Time::Seconds object, so |
292 | 169 | while examining the object will print the number of seconds (because |
293 | 170 | of the overloading), you can also get the number of minutes, hours, |
294 | 171 | days, weeks and years in that delta, using the Time::Seconds API. |
295 | 172 | |
296 | ||
173 | 上の例の最初のものは、Time::Seconds オブジェクトを返すことに注意して下さい。 | |
174 | オブジェクトを試験することで秒数を出力(オーバーロードによって)する一方で、 | |
175 | Time::Seconds のAPIを使って、その差異から、分数、時間数、日数、週の数、年数を、 | |
176 | 得ることが出来ます。 | |
297 | 177 | |
298 | ||
178 | =head2 日付の比較 | |
299 | オブジェクトを試験することで(オーバーロードによって)秒数を出力する一方で、 | |
300 | Time::Seconds の API を使って、その差異から、分数、時間数、日数、週の数、 | |
301 | 年数を得ることが出来ます。 | |
302 | 179 | |
303 | =begin original | |
304 | ||
305 | In addition to adding seconds, there are two APIs for adding months and | |
306 | years: | |
307 | ||
308 | =end original | |
309 | ||
310 | 秒の加算に加えて、月と年を加算するための二つの API があります: | |
311 | ||
312 | $t->add_months(6); | |
313 | $t->add_years(5); | |
314 | ||
315 | =begin original | |
316 | ||
317 | The months and years can be negative for subtractions. Note that there | |
318 | is some "strange" behaviour when adding and subtracting months at the | |
319 | ends of months. Generally when the resulting month is shorter than the | |
320 | starting month then the number of overlap days is added. For example | |
321 | subtracting a month from 2008-03-31 will not result in 2008-02-31 as this | |
322 | is an impossible date. Instead you will get 2008-03-02. This appears to | |
323 | be consistent with other date manipulation tools. | |
324 | ||
325 | =end original | |
326 | ||
327 | 月と年は減算のために負数にもなり得ます。 | |
328 | 月末で月を加減算すると「おかしな」振る舞いになることに注意してください。 | |
329 | 一般的に結果となる月が開始月より短い場合、重なった日の分が追加されます。 | |
330 | 例えば、2008-03-31 から 1 ヶ月引くと、あり得ない日付である 2008-02-31 には | |
331 | なりません。 | |
332 | 代わりに 2008-03-02 になります。 | |
333 | これは他の日付操作ツールと一貫性があるように思われます。 | |
334 | ||
335 | =head2 Date Comparisons | |
336 | ||
337 | (日付の比較) | |
338 | ||
339 | =begin original | |
340 | ||
341 | 180 | Date comparisons are also possible, using the full suite of "<", ">", |
342 | 181 | "<=", ">=", "<=>", "==" and "!=". |
343 | 182 | |
344 | = | |
183 | 日付の比較もまた可能です。 "<"、 ">"、"<="、 ">="、 "<=>"、 "=="、 "!=" | |
184 | の全てが使えます。 | |
345 | 185 | |
346 | 日付の | |
186 | =head2 日付の解析 | |
347 | "<"、 ">"、"<="、 ">="、 "<=>"、 "=="、 "!=" の全てが使えます。 | |
348 | 187 | |
349 | ||
188 | Time::Piece links to your C library's strptime() function, allowing | |
350 | ||
351 | (日付の解析) | |
352 | ||
353 | =begin original | |
354 | ||
355 | Time::Piece has a built-in strptime() function (from FreeBSD), allowing | |
356 | 189 | you incredibly flexible date parsing routines. For example: |
357 | 190 | |
358 | ||
191 | Time::Piece は、C ライブラリの strptime()関数にリンクしているので、 | |
192 | 信じられない程柔軟に日付を解析するルーチンを使えます。たとえば: | |
359 | 193 | |
360 | Time::Piece | |
194 | my $t = Time::Piece->strptime("Sun 3rd Nov, 1943", | |
361 | strptime() 関数を使えます。 | |
362 | たとえば: | |
363 | ||
364 | my $t = Time::Piece->strptime("Sunday 3rd Nov, 1943", | |
365 | 195 | "%A %drd %b, %Y"); |
366 | 196 | |
367 | 197 | print $t->strftime("%a, %d %b %Y"); |
368 | 198 | |
369 | =begin original | |
370 | ||
371 | Outputs: | |
372 | ||
373 | =end original | |
374 | ||
375 | 199 | 次のように出力します: |
376 | 200 | |
377 | 201 | Wed, 03 Nov 1943 |
378 | 202 | |
379 | =begin original | |
380 | ||
381 | 203 | (see, it's even smart enough to fix my obvious date bug) |
382 | 204 | |
383 | ||
205 | (見て下さい、一目瞭然な日付のバグを直すのに十分賢い) | |
384 | 206 | |
385 | (ほら、私の一目瞭然な日付のバグを直すのに十分なくらい賢いです) | |
386 | ||
387 | =begin original | |
388 | ||
389 | 207 | For more information see "man strptime", which should be on all unix |
390 | 208 | systems. |
391 | 209 | |
392 | ||
210 | もっと知りたければ、"man strptime"を見て下さい。これは、 | |
211 | すべての unix システムで使えます。 | |
393 | 212 | |
394 | もっと知りたければ、"man strptime" を見て下さい; | |
395 | これは、すべての unix システムで使えるはずです。 | |
396 | ||
397 | =begin original | |
398 | ||
399 | Alternatively look here: http://www.unix.com/man-page/FreeBSD/3/strftime/ | |
400 | ||
401 | =end original | |
402 | ||
403 | あるいは、次のリンクを見てください: | |
404 | http://www.unix.com/man-page/FreeBSD/3/strftime/ | |
405 | ||
406 | 213 | =head2 YYYY-MM-DDThh:mm:ss |
407 | 214 | |
408 | =begin original | |
409 | ||
410 | 215 | The ISO 8601 standard defines the date format to be YYYY-MM-DD, and |
411 | 216 | the time format to be hh:mm:ss (24 hour clock), and if combined, they |
412 | 217 | should be concatenated with date first and with a capital 'T' in front |
413 | 218 | of the time. |
414 | 219 | |
415 | ||
220 | ISO 8601 標準は、日付のフォーマットを YYYY-MM-DDとして、定めています。 | |
221 | 時間は、hh:mm:ss(24時)です。組み合わせる場合、 | |
222 | 日付を最初にして、時間の前に大文字の'T'で結び付ける必要があります。 | |
416 | 223 | |
417 | ||
224 | =head2 週番号 | |
418 | 時刻は hh:mm:ss(24 時制) として定めています。 | |
419 | 組み合わせる場合、日付を最初にして、時刻の前に大文字の 'T' で結び付ける | |
420 | 必要があります。 | |
421 | 225 | |
422 | =head2 Week Number | |
423 | ||
424 | (週番号) | |
425 | ||
426 | =begin original | |
427 | ||
428 | 226 | The I<week number> may be an unknown concept to some readers. The ISO |
429 | 227 | 8601 standard defines that weeks begin on a Monday and week 1 of the |
430 | 228 | year is the week that includes both January 4th and the first Thursday |
431 | 229 | of the year. In other words, if the first Monday of January is the |
432 | 230 | 2nd, 3rd, or 4th, the preceding days of the January are part of the |
433 | 231 | last week of the preceding year. Week numbers range from 1 to 53. |
434 | 232 | |
435 | ||
233 | I<週番号>は、読者によっては、その概念を知らないかもしれません。 | |
234 | ISO 8601 標準は、週は、月曜で始まり、一年のweek 1は、1月4日と、 | |
235 | 一年の最初の木曜日の両方を含む週です。 | |
236 | 言い換えると、1月の最初の月曜日が2日か、3日か、4日であれば、 | |
237 | その前の日は、昨年の最後の週の一部になります。週番号は、1から53の範囲です。 | |
436 | 238 | |
437 | ||
239 | =head2 グローバルなオーバーライド | |
438 | ISO 8601 標準は、週は月曜で始まり、その年の第 1 週は 1 月 4 日と | |
439 | 一年の最初の木曜日の両方を含む週であると定義しています。 | |
440 | 言い換えると、1 月の最初の月曜日が 2 日か、3 日か、4 日であれば、 | |
441 | それより前の日は、昨年の最後の週の一部になります。 | |
442 | 週番号は、1 から 53 の範囲です。 | |
443 | 240 | |
444 | =head2 Global Overriding | |
445 | ||
446 | (グローバルなオーバーライド) | |
447 | ||
448 | =begin original | |
449 | ||
450 | 241 | Finally, it's possible to override localtime and gmtime everywhere, by |
451 | 242 | including the ':override' tag in the import list: |
452 | 243 | |
453 | ||
244 | localtime と gmtime をどこにでもオーバーライドするのを可能にします。 | |
245 | インポートリストに、':override'を含めて下さい: | |
454 | 246 | |
455 | 最後に、localtime と gmtime をどこにでもオーバーライドすることが可能です; | |
456 | インポートリストに、':override' タグを含めて下さい: | |
457 | ||
458 | 247 | use Time::Piece ':override'; |
459 | 248 | |
460 | =head1 | |
249 | =head1 著者 | |
461 | 250 | |
462 | =head2 Setting $ENV{TZ} in Threads on Win32 | |
463 | ||
464 | (Win32 でスレッドで $ENV{TZ} を設定する) | |
465 | ||
466 | =begin original | |
467 | ||
468 | Note that when using perl in the default build configuration on Win32 | |
469 | (specifically, when perl is built with PERL_IMPLICIT_SYS), each perl | |
470 | interpreter maintains its own copy of the environment and only the main | |
471 | interpreter will update the process environment seen by strftime. | |
472 | ||
473 | =end original | |
474 | ||
475 | Win32 で perl をデフォルトビルド設定で使う場合 | |
476 | (特に perl が PERL_IMPLICIT_SYS でビルドされている場合)、 | |
477 | それぞれの perl インタプリタは独自の環境変数のコピーを保守していて、 | |
478 | メインインタプリタのみが strftime で見られるプロセス環境変数を | |
479 | 更新できることに注意してください。 | |
480 | ||
481 | =begin original | |
482 | ||
483 | Therefore, if you make changes to $ENV{TZ} from inside a thread other than | |
484 | the main thread then those changes will not be seen by strftime if you | |
485 | subsequently call that with the %Z formatting code. You must change $ENV{TZ} | |
486 | in the main thread to have the desired effect in this case (and you must | |
487 | also call _tzset() in the main thread to register the environment change). | |
488 | ||
489 | =end original | |
490 | ||
491 | 従って、メインスレッド以外のスレッド内から $ENV{TZ} を変更すると、 | |
492 | 後で strftime の %Z フォーマッティングコードを使っても変更は見えません。 | |
493 | この場合、望み通りの効果を得るためにはメインスレッドで | |
494 | $ENV{TZ} を変更しなければなりません (そして環境変数の変更を登録するために | |
495 | メインスレッドで _tzset() を呼び出さなければなりません)。 | |
496 | ||
497 | =begin original | |
498 | ||
499 | Furthermore, remember that this caveat also applies to fork(), which is | |
500 | emulated by threads on Win32. | |
501 | ||
502 | =end original | |
503 | ||
504 | さらに、この問題は fork() にも適用されることを忘れないでください; これは | |
505 | Win32 ではスレッドでエミュレートされています。 | |
506 | ||
507 | =head2 Use of epoch seconds | |
508 | ||
509 | (紀元秒を使う) | |
510 | ||
511 | =begin original | |
512 | ||
513 | This module internally uses the epoch seconds system that is provided via | |
514 | the perl C<time()> function and supported by C<gmtime()> and C<localtime()>. | |
515 | ||
516 | =end original | |
517 | ||
518 | このモジュールは、perl の C<time()> 経由で提供され、C<gmtime()> と | |
519 | C<localtime()> が対応している紀元秒システムを内部で使用しています。 | |
520 | ||
521 | =begin original | |
522 | ||
523 | If your perl does not support times larger than C<2^31> seconds then this | |
524 | module is likely to fail at processing dates beyond the year 2038. There are | |
525 | moves afoot to fix that in perl. Alternatively use 64 bit perl. Or if none | |
526 | of those are options, use the L<DateTime> module which has support for years | |
527 | well into the future and past. | |
528 | ||
529 | =end original | |
530 | ||
531 | C<2^31> 秒以上の時間に対応していない perl を使っている場合、このモジュールは | |
532 | 2038 年以降の日付を扱おうとするとおそらく失敗するでしょう。 | |
533 | これは perl 内で修正する動きがみられます。 | |
534 | あるいは、64 ビット perl を使ってください。 | |
535 | またはこれらの選択肢を取れない場合は、過去と未来の年に対応している | |
536 | L<DateTime> モジュールを使ってください。 | |
537 | ||
538 | =head1 AUTHOR | |
539 | ||
540 | 251 | Matt Sergeant, matt@sergeant.org |
541 | 252 | Jarkko Hietaniemi, jhi@iki.fi (while creating Time::Piece for core perl) |
542 | 253 | |
543 | =head1 | |
254 | =head1 ライセンス | |
544 | 255 | |
545 | 256 | This module is free software, you may distribute it under the same terms |
546 | 257 | as Perl. |
547 | 258 | |
548 | 259 | =head1 SEE ALSO |
549 | 260 | |
550 | =begin original | |
551 | ||
552 | 261 | The excellent Calendar FAQ at http://www.tondering.dk/claus/calendar.html |
553 | 262 | |
554 | =e | |
263 | =head1 バグ | |
555 | 264 | |
556 | http://www.tondering.dk/claus/calendar.html にある素晴らしいカレンダー FAQ。 | |
557 | ||
558 | =head1 BUGS | |
559 | ||
560 | =begin original | |
561 | ||
562 | 265 | The test harness leaves much to be desired. Patches welcome. |
563 | 266 | |
564 | =e | |
267 | =head1 翻訳について | |
565 | 268 | |
566 | ||
269 | 翻訳者:加藤敦 (ktat.is@gmail.com) | |
567 | パッチを歓迎します。 | |
568 | 270 | |
569 | ||
271 | Perlドキュメント日本語訳 Project にて、 | |
272 | Perlモジュール、ドキュメントの翻訳を行っております。 | |
570 | 273 | |
571 | ||
274 | http://perldocjp.sourceforge.jp/ | |
572 | ||
275 | http://sourceforge.jp/projects/perldocjp/ | |
276 | http://www.freeml.com/ctrl/html/MLInfoForm/perldocjp@freeml.com | |
574 | ||
277 | http://www.perldoc.jp | |
575 | ||
576 | =cut |