Time-Piece-1.20 >
1.08
との差分
Time::Piece 1.08 と 1.20 の差分
| 1 | 1 | |
| 2 | 2 | =encoding euc-jp |
| 3 | 3 | |
| 4 | =head1 | |
| 4 | =head1 NAME | |
| 5 | 5 | |
| 6 | =begin original | |
| 7 | ||
| 8 | Time::Piece - Object Oriented time objects | |
| 9 | ||
| 10 | =end original | |
| 11 | ||
| 6 | 12 | Time::Piece - オブジェクト指向な時間オブジェクト |
| 7 | 13 | |
| 8 | =head1 | |
| 14 | =head1 SYNOPSIS | |
| 9 | 15 | |
| 10 | 16 | use Time::Piece; |
| 11 | 17 | |
| 12 | 18 | my $t = localtime; |
| 13 | 19 | print "Time is $t\n"; |
| 14 | 20 | print "Year is ", $t->year, "\n"; |
| 15 | 21 | |
| 16 | =head1 | |
| 22 | =head1 DESCRIPTION | |
| 17 | 23 | |
| 24 | =begin original | |
| 25 | ||
| 18 | 26 | This module replaces the standard localtime and gmtime functions with |
| 19 | 27 | implementations that return objects. It does so in a backwards |
| 20 | 28 | compatible manner, so that using localtime/gmtime in the way documented |
| 21 | 29 | in perlfunc will still return what you expect. |
| 22 | 30 | |
| 23 | ||
| 31 | =end original | |
| 24 | 後方互換性があるので、perlfunc に書かれているように、localtime/gmtime を使っても、期待通りのものを返します。 | |
| 25 | 32 | |
| 33 | このモジュールは、標準の localtime と gmtime 関数を、オブジェクトを返す | |
| 34 | 実装のものに置き換えます。 | |
| 35 | これを後方互換性がある形で行うので、perlfunc に書かれているように | |
| 36 | localtime/gmtime を使っても、期待通りのものを返します。 | |
| 37 | ||
| 38 | =begin original | |
| 39 | ||
| 26 | 40 | The module actually implements most of an interface described by |
| 27 | 41 | Larry Wall on the perl5-porters mailing list here: |
| 28 | 42 | http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-01/msg00241.html |
| 29 | 43 | |
| 30 | ||
| 44 | =end original | |
| 31 | ||
| 46 | このモジュールは、Larry Wall が perl5-porters メーリングリストに書いた、 | |
| 47 | インターフェースのほとんどを実際に実装します: | |
| 32 | 48 | http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-01/msg00241.html |
| 33 | 49 | |
| 34 | =head1 | |
| 50 | =head1 USAGE | |
| 35 | 51 | |
| 52 | (使い方) | |
| 53 | ||
| 54 | =begin original | |
| 55 | ||
| 36 | 56 | After importing this module, when you use localtime or gmtime in a scalar |
| 37 | 57 | context, rather than getting an ordinary scalar string representing the |
| 38 | 58 | date and time, you get a Time::Piece object, whose stringification happens |
| 39 | 59 | to produce the same effect as the localtime and gmtime functions. There is |
| 40 | 60 | also a new() constructor provided, which is the same as localtime(), except |
| 41 | 61 | when passed a Time::Piece object, in which case it's a copy constructor. The |
| 42 | 62 | following methods are available on the object: |
| 43 | 63 | |
| 44 | ||
| 64 | =end original | |
| 45 | ||
| 46 | ||
| 66 | このモジュールをインポートした後は、スカラコンテキストで localtime か | |
| 47 | ||
| 67 | gmtime を使うと、日付と時間を表現する普通のスカラ文字列ではなく、 | |
| 48 | Time::Pieceオブジェクト | |
| 68 | Time::Piece オブジェクトを得ます。 | |
| 69 | Time::Piece オブジェクトの文字列化は、偶然にも localtime と gmtime 関数と | |
| 70 | 同じ効果があります。 | |
| 71 | new() コンストラクタもありますが、Time::Piece オブジェクトが渡されない限り | |
| 72 | localtime() と同じです。 | |
| 73 | Time::Piece オブジェクトが渡されると、コピーコンストラクタになります。 | |
| 49 | 74 | 下記のメソッドがオブジェクトで利用できます: |
| 50 | 75 | |
| 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 | ||
| 51 | 139 | $t->sec # $t->second も可 |
| 52 | 140 | $t->min # $t->minute も可 |
| 53 | $t->hour # 24時制 | |
| 141 | $t->hour # 24 時制 | |
| 54 | 142 | $t->mday # $t->day_of_month も可 |
| 55 | 143 | $t->mon # 1 = 一月 |
| 56 | 144 | $t->_mon # 0 = 一月 |
| 57 | 145 | $t->monname # Feb |
| 58 | 146 | $t->month # $t->monname と同じ |
| 59 | 147 | $t->fullmonth # February |
| 60 | $t->year # 0始まり(AD0年は、もちろん、BC1年) | |
| 148 | $t->year # 0 始まり(AD 0 年は、もちろん、BC 1 年) | |
| 61 | $t->_year # 年から1900引いたもの | |
| 149 | $t->_year # 年から 1900 を引いたもの | |
| 62 | $t->yy # 2桁の年 | |
| 150 | $t->yy # 2 桁の年 | |
| 63 | 151 | $t->wday # 1 = 日曜 |
| 64 | 152 | $t->_wday # 0 = 日曜 |
| 65 | 153 | $t->day_of_week # 0 = 日曜 |
| 66 | 154 | $t->wdayname # Tue |
| 67 | 155 | $t->day # wdayname と同じ |
| 68 | 156 | $t->fullday # Tuesday |
| 69 | $t->yday # $t->day_of_year も可, 0 = | |
| 157 | $t->yday # $t->day_of_year も可, 0 = 1 月 1 日 | |
| 70 | 158 | $t->isdst # $t->daylight_savings も可。 |
| 71 | 159 | |
| 72 | 160 | $t->hms # 12:34:56 |
| 73 | 161 | $t->hms(".") # 12.34.56 |
| 74 | 162 | $t->time # $t->hms と同じ |
| 75 | 163 | |
| 76 | 164 | $t->ymd # 2000-02-29 |
| 77 | 165 | $t->date # $t->ymd と同じ |
| 78 | 166 | $t->mdy # 02-29-2000 |
| 79 | 167 | $t->mdy("/") # 02/29/2000 |
| 80 | 168 | $t->dmy # 29-02-2000 |
| 81 | 169 | $t->dmy(".") # 29.02.2000 |
| 82 | 170 | $t->datetime # 2000-02-29T12:34:56 (ISO 8601) |
| 83 | 171 | $t->cdate # Tue Feb 29 12:34:56 2000 |
| 84 | 172 | "$t" # $t->cdate と同じ |
| 85 | 173 | |
| 86 | 174 | $t->epoch # epochからの秒 |
| 87 | $t->tzoffset # | |
| 175 | $t->tzoffset # Time::Seconds オブジェクトによるタイムゾーンオフセット | |
| 88 | 176 | |
| 89 | 177 | $t->julian_day # ユリウス歴が始まってからの日の数 |
| 90 | $t->mjd # | |
| 178 | $t->mjd # 修正ユリウス日 (JD-2400000.5 日) | |
| 91 | 179 | |
| 92 | 180 | $t->week # 週番号 (ISO 8601) |
| 93 | 181 | |
| 94 | 182 | $t->is_leap_year # 閏年なら真を返す |
| 95 | 183 | $t->month_last_day # 28-31 |
| 96 | 184 | |
| 97 | $t->time_separator($s) # デフォルトのセパレータを | |
| 185 | $t->time_separator($s) # デフォルトのセパレータを設定 (デフォルト ":") | |
| 98 | $t->date_separator($s) # デフォルトのセパレータを | |
| 186 | $t->date_separator($s) # デフォルトのセパレータを設定 (デフォルト "-") | |
| 99 | $t->day_list(@days) # デフォルトの曜日を | |
| 187 | $t->day_list(@days) # デフォルトの曜日を設定 | |
| 100 | $t->mon_list(@days) # デフォルトの月名を | |
| 188 | $t->mon_list(@days) # デフォルトの月名を設定 | |
| 101 | 189 | |
| 102 | $t->strftime(FORMAT) # POSIX::strftime と同じ( | |
| 190 | $t->strftime(FORMAT) # POSIX::strftime と同じ(しかし完全な | |
| 103 | # | |
| 191 | # POSIX 拡張のためのオーバーヘッドはありません) | |
| 104 | 192 | $t->strftime() # "Tue, 29 Feb 2000 12:34:56 GMT" |
| 105 | 193 | |
| 106 | 194 | Time::Piece->strptime(STRING, FORMAT) |
| 107 | # strptime man ページを見て下さい | |
| 195 | # strptime man ページを見て下さい。新しく | |
| 108 | # | |
| 196 | # Time::Piece オブジェクトを作ります | |
| 109 | 197 | |
| 110 | 198 | =head2 Local Locales |
| 111 | 199 | |
| 200 | (ローカルロケール) | |
| 201 | ||
| 202 | =begin original | |
| 203 | ||
| 112 | 204 | Both wdayname (day) and monname (month) allow passing in a list to use |
| 113 | 205 | to index the name of the days against. This can be useful if you need |
| 114 | 206 | to implement some form of localisation without actually installing or |
| 115 | 207 | using locales. |
| 116 | 208 | |
| 117 | ||
| 209 | =end original | |
| 118 | 許しています。実際にインストールしたり、ロケールを使わずに、 | |
| 119 | なんらかのローカライゼーションを実装する必要があれば、有益でしょう。 | |
| 120 | 210 | |
| 211 | wdayname (day) と monname (month) の両方ともに、曜日のインデックスに使う | |
| 212 | リストを渡すことができます。 | |
| 213 | 実際にロケールをインストールしたり使ったりせずに、ある種の地域化を実装する | |
| 214 | 必要があるなら、有益でしょう。 | |
| 215 | ||
| 121 | 216 | my @days = qw( Dimanche Lundi Merdi Mercredi Jeudi Vendredi Samedi ); |
| 122 | 217 | |
| 123 | 218 | my $french_day = localtime->day(@days); |
| 124 | 219 | |
| 220 | =begin original | |
| 221 | ||
| 125 | 222 | These settings can be overriden globally too: |
| 126 | 223 | |
| 224 | =end original | |
| 225 | ||
| 127 | 226 | これらの設定はグローバルにもオーバーライドできます: |
| 128 | 227 | |
| 129 | 228 | Time::Piece::day_list(@days); |
| 130 | 229 | |
| 230 | =begin original | |
| 231 | ||
| 131 | 232 | Or for months: |
| 132 | 233 | |
| 234 | =end original | |
| 235 | ||
| 133 | 236 | また、月なら: |
| 134 | 237 | |
| 135 | 238 | Time::Piece::mon_list(@months); |
| 136 | 239 | |
| 240 | =begin original | |
| 241 | ||
| 137 | 242 | And locally for months: |
| 138 | 243 | |
| 139 | ||
| 244 | =end original | |
| 140 | 245 | |
| 246 | 月に関してローカルに行うなら: | |
| 247 | ||
| 141 | 248 | print localtime->month(@months); |
| 142 | 249 | |
| 143 | =head2 | |
| 250 | =head2 Date Calculations | |
| 144 | 251 | |
| 252 | (日付の演算) | |
| 253 | ||
| 254 | =begin original | |
| 255 | ||
| 145 | 256 | It's possible to use simple addition and subtraction of objects: |
| 146 | 257 | |
| 258 | =end original | |
| 259 | ||
| 147 | 260 | 単純なオブジェクトの足し算、引き算ができます: |
| 148 | 261 | |
| 149 | 262 | use Time::Seconds; |
| 150 | 263 | |
| 151 | 264 | my $seconds = $t1 - $t2; |
| 152 | 265 | $t1 += ONE_DAY; # add 1 day (constant from Time::Seconds) |
| 153 | 266 | |
| 267 | =begin original | |
| 268 | ||
| 154 | 269 | The following are valid ($t1 and $t2 are Time::Piece objects): |
| 155 | 270 | |
| 156 | ||
| 271 | =end original | |
| 157 | 272 | |
| 273 | 下記のものは有効です($t1 と $t2 は Time::Piece オブジェクト): | |
| 274 | ||
| 158 | 275 | $t1 - $t2; # returns Time::Seconds object |
| 159 | 276 | $t1 - 42; # returns Time::Piece object |
| 160 | 277 | $t1 + 533; # returns Time::Piece object |
| 161 | 278 | |
| 279 | =begin original | |
| 280 | ||
| 162 | 281 | However adding a Time::Piece object to another Time::Piece object |
| 163 | 282 | will cause a runtime error. |
| 164 | 283 | |
| 165 | ||
| 284 | =end original | |
| 285 | ||
| 286 | ですが、Time::Piece オブジェクトに別の Time::Piece オブジェクトを | |
| 166 | 287 | 足すのは、実行時エラーを引き起こします。 |
| 167 | 288 | |
| 289 | =begin original | |
| 290 | ||
| 168 | 291 | Note that the first of the above returns a Time::Seconds object, so |
| 169 | 292 | while examining the object will print the number of seconds (because |
| 170 | 293 | of the overloading), you can also get the number of minutes, hours, |
| 171 | 294 | days, weeks and years in that delta, using the Time::Seconds API. |
| 172 | 295 | |
| 173 | ||
| 296 | =end original | |
| 174 | オブジェクトを試験することで秒数を出力(オーバーロードによって)する一方で、 | |
| 175 | Time::Seconds のAPIを使って、その差異から、分数、時間数、日数、週の数、年数を、 | |
| 176 | 得ることが出来ます。 | |
| 177 | 297 | |
| 178 | ||
| 298 | 上の例の最初のものは、Time::Seconds オブジェクトを返すことに注意して下さい; | |
| 299 | オブジェクトを試験することで(オーバーロードによって)秒数を出力する一方で、 | |
| 300 | Time::Seconds の API を使って、その差異から、分数、時間数、日数、週の数、 | |
| 301 | 年数を得ることが出来ます。 | |
| 179 | 302 | |
| 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 | ||
| 180 | 341 | Date comparisons are also possible, using the full suite of "<", ">", |
| 181 | 342 | "<=", ">=", "<=>", "==" and "!=". |
| 182 | 343 | |
| 183 | ||
| 344 | =end original | |
| 184 | の全てが使えます。 | |
| 185 | 345 | |
| 186 | ||
| 346 | 日付の比較も可能です; | |
| 347 | "<"、 ">"、"<="、 ">="、 "<=>"、 "=="、 "!=" の全てが使えます。 | |
| 187 | 348 | |
| 188 | ||
| 349 | =head2 Date Parsing | |
| 350 | ||
| 351 | (日付の解析) | |
| 352 | ||
| 353 | =begin original | |
| 354 | ||
| 355 | Time::Piece has a built-in strptime() function (from FreeBSD), allowing | |
| 189 | 356 | you incredibly flexible date parsing routines. For example: |
| 190 | 357 | |
| 191 | ||
| 358 | =end original | |
| 192 | 信じられない程柔軟に日付を解析するルーチンを使えます。たとえば: | |
| 193 | 359 | |
| 194 | ||
| 360 | Time::Piece は、驚くほど柔軟に日付を解析する組み込みの (FreeBSD 由来の) | |
| 361 | strptime() 関数を使えます。 | |
| 362 | たとえば: | |
| 363 | ||
| 364 | my $t = Time::Piece->strptime("Sunday 3rd Nov, 1943", | |
| 195 | 365 | "%A %drd %b, %Y"); |
| 196 | 366 | |
| 197 | 367 | print $t->strftime("%a, %d %b %Y"); |
| 198 | 368 | |
| 369 | =begin original | |
| 370 | ||
| 371 | Outputs: | |
| 372 | ||
| 373 | =end original | |
| 374 | ||
| 199 | 375 | 次のように出力します: |
| 200 | 376 | |
| 201 | 377 | Wed, 03 Nov 1943 |
| 202 | 378 | |
| 379 | =begin original | |
| 380 | ||
| 203 | 381 | (see, it's even smart enough to fix my obvious date bug) |
| 204 | 382 | |
| 205 | ||
| 383 | =end original | |
| 206 | 384 | |
| 385 | (ほら、私の一目瞭然な日付のバグを直すのに十分なくらい賢いです) | |
| 386 | ||
| 387 | =begin original | |
| 388 | ||
| 207 | 389 | For more information see "man strptime", which should be on all unix |
| 208 | 390 | systems. |
| 209 | 391 | |
| 210 | ||
| 392 | =end original | |
| 211 | すべての unix システムで使えます。 | |
| 212 | 393 | |
| 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 | ||
| 213 | 406 | =head2 YYYY-MM-DDThh:mm:ss |
| 214 | 407 | |
| 408 | =begin original | |
| 409 | ||
| 215 | 410 | The ISO 8601 standard defines the date format to be YYYY-MM-DD, and |
| 216 | 411 | the time format to be hh:mm:ss (24 hour clock), and if combined, they |
| 217 | 412 | should be concatenated with date first and with a capital 'T' in front |
| 218 | 413 | of the time. |
| 219 | 414 | |
| 220 | ||
| 415 | =end original | |
| 221 | 時間は、hh:mm:ss(24時)です。組み合わせる場合、 | |
| 222 | 日付を最初にして、時間の前に大文字の'T'で結び付ける必要があります。 | |
| 223 | 416 | |
| 224 | ||
| 417 | ISO 8601 標準は、日付のフォーマットを YYYY-MM-DD として、 | |
| 418 | 時刻は hh:mm:ss(24 時制) として定めています。 | |
| 419 | 組み合わせる場合、日付を最初にして、時刻の前に大文字の 'T' で結び付ける | |
| 420 | 必要があります。 | |
| 225 | 421 | |
| 422 | =head2 Week Number | |
| 423 | ||
| 424 | (週番号) | |
| 425 | ||
| 426 | =begin original | |
| 427 | ||
| 226 | 428 | The I<week number> may be an unknown concept to some readers. The ISO |
| 227 | 429 | 8601 standard defines that weeks begin on a Monday and week 1 of the |
| 228 | 430 | year is the week that includes both January 4th and the first Thursday |
| 229 | 431 | of the year. In other words, if the first Monday of January is the |
| 230 | 432 | 2nd, 3rd, or 4th, the preceding days of the January are part of the |
| 231 | 433 | last week of the preceding year. Week numbers range from 1 to 53. |
| 232 | 434 | |
| 233 | ||
| 435 | =end original | |
| 234 | ISO 8601 標準は、週は、月曜で始まり、一年のweek 1は、1月4日と、 | |
| 235 | 一年の最初の木曜日の両方を含む週です。 | |
| 236 | 言い換えると、1月の最初の月曜日が2日か、3日か、4日であれば、 | |
| 237 | その前の日は、昨年の最後の週の一部になります。週番号は、1から53の範囲です。 | |
| 238 | 436 | |
| 239 | ||
| 437 | I<週番号> は、概念を知らない読者もいるかもしれません。 | |
| 438 | ISO 8601 標準は、週は月曜で始まり、その年の第 1 週は 1 月 4 日と | |
| 439 | 一年の最初の木曜日の両方を含む週であると定義しています。 | |
| 440 | 言い換えると、1 月の最初の月曜日が 2 日か、3 日か、4 日であれば、 | |
| 441 | それより前の日は、昨年の最後の週の一部になります。 | |
| 442 | 週番号は、1 から 53 の範囲です。 | |
| 240 | 443 | |
| 444 | =head2 Global Overriding | |
| 445 | ||
| 446 | (グローバルなオーバーライド) | |
| 447 | ||
| 448 | =begin original | |
| 449 | ||
| 241 | 450 | Finally, it's possible to override localtime and gmtime everywhere, by |
| 242 | 451 | including the ':override' tag in the import list: |
| 243 | 452 | |
| 244 | ||
| 453 | =end original | |
| 245 | インポートリストに、':override'を含めて下さい: | |
| 246 | 454 | |
| 455 | 最後に、localtime と gmtime をどこにでもオーバーライドすることが可能です; | |
| 456 | インポートリストに、':override' タグを含めて下さい: | |
| 457 | ||
| 247 | 458 | use Time::Piece ':override'; |
| 248 | 459 | |
| 249 | =head1 | |
| 460 | =head1 CAVEATS | |
| 250 | 461 | |
| 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 | ||
| 251 | 540 | Matt Sergeant, matt@sergeant.org |
| 252 | 541 | Jarkko Hietaniemi, jhi@iki.fi (while creating Time::Piece for core perl) |
| 253 | 542 | |
| 254 | =head1 | |
| 543 | =head1 License | |
| 255 | 544 | |
| 256 | 545 | This module is free software, you may distribute it under the same terms |
| 257 | 546 | as Perl. |
| 258 | 547 | |
| 259 | 548 | =head1 SEE ALSO |
| 260 | 549 | |
| 550 | =begin original | |
| 551 | ||
| 261 | 552 | The excellent Calendar FAQ at http://www.tondering.dk/claus/calendar.html |
| 262 | 553 | |
| 263 | = | |
| 554 | =end original | |
| 264 | 555 | |
| 556 | http://www.tondering.dk/claus/calendar.html にある素晴らしいカレンダー FAQ。 | |
| 557 | ||
| 558 | =head1 BUGS | |
| 559 | ||
| 560 | =begin original | |
| 561 | ||
| 265 | 562 | The test harness leaves much to be desired. Patches welcome. |
| 266 | 563 | |
| 267 | = | |
| 564 | =end original | |
| 268 | 565 | |
| 269 | ||
| 566 | テストハーネスは望ましい状態にはほど遠いです。 | |
| 567 | パッチを歓迎します。 | |
| 270 | 568 | |
| 271 | ||
| 569 | =begin meta | |
| 272 | Perlモジュール、ドキュメントの翻訳を行っております。 | |
| 273 | 570 | |
| 274 | | |
| 571 | Translate: 加藤敦 <ktat.is@gmail.com> (1.08) | |
| 275 | ||
| 572 | Update: SHIRAKATA Kentaro <argrath@ub32.org> (1.20) | |
| 276 | ||
| 277 | ||
| 574 | =end meta | |
| 575 | ||
| 576 | =cut |