diff --git a/reference/datetime/entities.ent b/reference/datetime/entities.ent
new file mode 100644
index 0000000000..26495df0fb
--- /dev/null
+++ b/reference/datetime/entities.ent
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+ 結果が
+ 期間の最大長
+ を超える場合、Time\TimeException
+ がスローされます。
+
+
+
+
+
diff --git a/reference/datetime/time.duration.xml b/reference/datetime/time.duration.xml
new file mode 100644
index 0000000000..7f92e9bf5e
--- /dev/null
+++ b/reference/datetime/time.duration.xml
@@ -0,0 +1,239 @@
+
+
+
+
+ Time\Duration クラス
+ Time\Duration
+
+
+
+ &reftitle.intro;
+
+ タイムアウトや、ストップウォッチで計った時間のような、
+ 長さが一定の経過時間をナノ秒の精度で表します。
+ 期間は、負でない整数の秒数
+ (Time\Duration::$seconds)、1 秒未満のナノ秒数
+ (Time\Duration::$nanoseconds)、符号
+ (Time\Duration::$negative) で構成されます。
+
+
+ 日、月、年などの暦の単位は一定の秒数に対応しないため、
+ Time\Duration は
+ DateInterval とは異なり、これらの単位を持ちません。
+ DST (夏時間) の移行をまたぐと 1 日は 23 時間や 25 時間になることがあり、
+ 月の長さもまちまちです。
+ そのため、期間の作成に使える最大の単位は時間です。
+ DateTimeImmutable オブジェクトで暦に基づいて計算するには
+ DateInterval を、
+ I/O ポーリング API の
+ timeout のように曖昧さのない時間の長さを扱うには
+ Time\Duration を使ってください。
+
+
+ このクラスのオブジェクトは不変です。
+ 作成には Time\Duration::from*()
+ ファクトリメソッドのいずれかを使います。
+ Time\Duration::add や
+ Time\Duration::multiplyBy などの操作はどれも、
+ 既存のオブジェクトを変更せず、新しいオブジェクトを返します。
+ 期間は負にもなりえます。
+ 多くの場合、Time\Duration::sub や
+ Time\Duration::negate の結果として負になります。
+ 長さ 0 の期間が負になることはありません。
+
+
+ 2 つの期間は、
+ 比較演算子
+ (<、<=、
+ ==、!=、>=、
+ >、<=>) でも
+ Time\Duration::compare でも比較できます。
+ 算術演算子
+ はサポートされていません。
+ 代わりにこのクラスのメソッドを使ってください。
+
+
+ 期間の最大長は、64 ビットプラットフォームでは
+ 9223372035 秒 (約 292 年)、
+ 32 ビットプラットフォームでは
+ 2147483647 秒 (約 68 年) です。
+ 結果がこの範囲を超える操作はどれも
+ Time\TimeException をスローします。
+
+
+
+
+ &reftitle.classsynopsis;
+
+
+ Time
+
+
+
+ final
+ readonly
+ Duration
+
+
+ &Properties;
+
+ public
+ readonly
+ int
+ seconds
+
+
+ public
+ readonly
+ int
+ nanoseconds
+
+
+ public
+ readonly
+ bool
+ negative
+
+
+ &Methods;
+
+
+
+
+
+
+
+ &reftitle.properties;
+
+
+ seconds
+
+
+ 符号を除いた整数の秒数。
+ 常に 0 以上で、最大値は 64 ビットプラットフォームでは
+ 9223372035、32 ビットプラットフォームでは
+ 2147483647 です。
+
+
+
+
+ nanoseconds
+
+
+ 符号を除いた 1 秒未満の端数 (ナノ秒単位)。
+ 常に 0 以上
+ 999999999 以下です。
+
+
+
+
+ negative
+
+
+ 期間が負かどうか。
+ 符号は期間全体に適用されるため、-1.5 秒の期間では、
+ seconds が 1、
+ nanoseconds が 500000000、
+ negative が &true; になります。
+ 長さ 0 の期間では、このプロパティは常に &false; です。
+
+
+
+
+
+
+
+ &reftitle.examples;
+
+ 期間の作成と足し合わせ
+
+add(\Time\Duration::fromMilliseconds(1500));
+
+var_dump($timeout);
+printf("%d.%09d seconds\n", $timeout->seconds, $timeout->nanoseconds);
+]]>
+
+ &example.outputs;
+
+
+ int(61)
+ ["nanoseconds"]=>
+ int(500000000)
+ ["negative"]=>
+ bool(false)
+}
+61.500000000 seconds
+]]>
+
+
+
+ 期間の比較
+
+seconds, $duration->nanoseconds);
+}
+
+var_dump(\Time\Duration::fromMinutes(1) > \Time\Duration::fromSeconds(59));
+var_dump(\Time\Duration::fromSeconds(1) == \Time\Duration::fromMilliseconds(1000));
+]]>
+
+ &example.outputs;
+
+
+
+
+
+
+
+ &reftitle.seealso;
+
+ DateInterval
+ hrtime
+
+
+
+
+
+ &reference.datetime.time.entities.duration;
+
+
+
diff --git a/reference/datetime/time.timeexception.xml b/reference/datetime/time.timeexception.xml
new file mode 100644
index 0000000000..1400d561d7
--- /dev/null
+++ b/reference/datetime/time.timeexception.xml
@@ -0,0 +1,62 @@
+
+
+
+
+ Time\TimeException クラス
+ Time\TimeException
+
+
+
+ &reftitle.intro;
+
+ Time 名前空間の例外の基底クラスです。
+
+
+
+
+ &reftitle.classsynopsis;
+
+
+ Time
+
+
+
+ TimeException
+
+
+
+ extends
+ Exception
+
+
+ &InheritedProperties;
+
+
+ &InheritedMethods;
+
+
+
+
+
+
+
+
diff --git a/reference/datetime/time/duration/absolute.xml b/reference/datetime/time/duration/absolute.xml
new file mode 100644
index 0000000000..76a5db2116
--- /dev/null
+++ b/reference/datetime/time/duration/absolute.xml
@@ -0,0 +1,94 @@
+
+
+
+
+
+ Time\Duration::absolute
+ 期間の絶対値を返す
+
+
+
+ &reftitle.description;
+
+ public Time\DurationTime\Duration::absolute
+
+
+
+ 期間の絶対値を返します。
+ つまり、Time\Duration::$seconds と
+ Time\Duration::$nanoseconds はこの期間と同じ値のまま、
+ Time\Duration::$negative プロパティを &false; にした期間です。
+
+
+
+
+ &reftitle.parameters;
+ &no.function.parameters;
+
+
+
+ &reftitle.returnvalues;
+
+ 負でない Time\Duration オブジェクトを返します。
+
+
+
+
+ &reftitle.examples;
+
+ Time\Duration::absolute の例
+
+sub(\Time\Duration::fromSeconds(25));
+
+var_dump($difference->negative);
+var_dump($difference->absolute());
+]]>
+
+ &example.outputs;
+
+
+ int(15)
+ ["nanoseconds"]=>
+ int(0)
+ ["negative"]=>
+ bool(false)
+}
+]]>
+
+
+
+
+
+ &reftitle.seealso;
+
+ Time\Duration::negate
+ Time\Duration::sub
+
+
+
+
+
diff --git a/reference/datetime/time/duration/add.xml b/reference/datetime/time/duration/add.xml
new file mode 100644
index 0000000000..c0ebdc319a
--- /dev/null
+++ b/reference/datetime/time/duration/add.xml
@@ -0,0 +1,115 @@
+
+
+
+
+
+ Time\Duration::add
+ 期間を加算する
+
+
+
+ &reftitle.description;
+
+ public Time\DurationTime\Duration::add
+ Time\Durationduration
+
+
+ この期間と duration の和を返します。
+ どちらの期間の符号も考慮されるため、正の期間に負の期間を加算すると、元の期間より短くなります。
+
+
+
+
+ &reftitle.parameters;
+
+
+ duration
+
+
+ 加算する期間。
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ 新しい Time\Duration オブジェクトを返します。
+
+
+
+
+ &reftitle.errors;
+
+ &ext.datetime.duration-too-long;
+
+
+
+
+ &reftitle.examples;
+
+ Time\Duration::add の例
+
+add(\Time\Duration::fromSeconds(30))
+ ->add(\Time\Duration::fromMilliseconds(500));
+
+var_dump($total);
+
+// 負の期間を加算すると、減算になります。
+$result = \Time\Duration::fromSeconds(10)
+ ->add(\Time\Duration::fromSeconds(4)->negate());
+
+var_dump($result->seconds);
+]]>
+
+ &example.outputs;
+
+
+ int(90)
+ ["nanoseconds"]=>
+ int(500000000)
+ ["negative"]=>
+ bool(false)
+}
+int(6)
+]]>
+
+
+
+
+
+ &reftitle.seealso;
+
+ Time\Duration::sub
+ Time\Duration::multiplyBy
+
+
+
+
+
diff --git a/reference/datetime/time/duration/compare.xml b/reference/datetime/time/duration/compare.xml
new file mode 100644
index 0000000000..7082d96de0
--- /dev/null
+++ b/reference/datetime/time/duration/compare.xml
@@ -0,0 +1,151 @@
+
+
+
+
+
+ Time\Duration::compare
+ 2 つの期間を比較する
+
+
+
+ &reftitle.description;
+
+ public static intTime\Duration::compare
+ Time\Durationa
+ Time\Durationb
+
+
+ 期間 a と
+ b を、符号を考慮して比較します。
+ 戻り値は、usort
+ の比較関数が返す値として使えます。
+
+
+ 両方のオペランドが Time\Duration オブジェクトの場合、
+ 比較演算子
+ による大小関係も、このメソッドと同じになります。
+
+
+
+
+ &reftitle.parameters;
+
+
+ a
+
+
+ 最初の期間。
+
+
+
+
+ b
+
+
+ 2 番目の期間。
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ a が b より小さければ
+ 0 より小さな値を、
+ a が b より大きければ
+ 0 より大きな値を、
+ 両者が等しければ 0 を返します。
+ 返却される値の絶対値に、特に意味はありません。
+ 負の期間は、常に正の期間より小さくなります。
+
+
+
+
+ &reftitle.examples;
+
+ Time\Duration::compare の例
+
+ 0);
+var_dump(\Time\Duration::compare($oneSecond, $billionNanoseconds) === 0);
+
+// 負の期間は正の期間より小さくなります。
+var_dump(\Time\Duration::compare($oneSecond->negate(), $oneSecond) < 0);
+]]>
+
+ &example.outputs;
+
+
+
+
+
+ Time\Duration::compare で期間をソートする
+
+seconds, $duration->nanoseconds);
+}
+]]>
+
+ &example.outputs;
+
+
+
+
+
+
+
+ &reftitle.seealso;
+
+ 比較演算子
+ usort
+
+
+
+
+
diff --git a/reference/datetime/time/duration/construct.xml b/reference/datetime/time/duration/construct.xml
new file mode 100644
index 0000000000..9f93a72937
--- /dev/null
+++ b/reference/datetime/time/duration/construct.xml
@@ -0,0 +1,71 @@
+
+
+
+
+
+ Time\Duration::__construct
+ private なコンストラクタのため、直接インスタンス化できません
+
+
+
+ &reftitle.description;
+
+ private Time\Duration::__construct
+
+
+
+ このコンストラクタは private なので、Time\Duration
+ オブジェクトは new で作成できません。
+ 代わりに、渡す値の単位を明示するファクトリメソッドのいずれかを使ってください:
+ Time\Duration::fromSeconds、
+ Time\Duration::fromNanoseconds、
+ Time\Duration::fromMicroseconds、
+ Time\Duration::fromMilliseconds、
+ Time\Duration::fromMinutes、
+ Time\Duration::fromHours、
+ Time\Duration::fromIso8601DurationString。
+
+
+
+
+ &reftitle.parameters;
+ &no.function.parameters;
+
+
+
+ &reftitle.errors;
+
+ new でこのクラスをインスタンス化しようとすると、
+ Error がスローされます。
+
+
+
+
+ &reftitle.seealso;
+
+ Time\Duration::fromSeconds
+ Time\Duration::fromIso8601DurationString
+
+
+
+
+
diff --git a/reference/datetime/time/duration/divideby.xml b/reference/datetime/time/duration/divideby.xml
new file mode 100644
index 0000000000..651210890a
--- /dev/null
+++ b/reference/datetime/time/duration/divideby.xml
@@ -0,0 +1,125 @@
+
+
+
+
+
+ Time\Duration::divideBy
+ 期間を整数で割る
+
+
+
+ &reftitle.description;
+
+ public Time\DurationTime\Duration::divideBy
+ intdivisor
+
+
+ この期間を divisor で割った期間を返します。
+ 1 ナノ秒未満の端数は切り捨てられるため、結果は 0 に近い方向に丸められます。
+ 符号は維持されます。
+
+
+
+
+ &reftitle.parameters;
+
+
+ divisor
+
+
+ 除数。
+ 0 より大きくなければなりません。
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ 新しい Time\Duration オブジェクトを返します。
+
+
+
+
+ &reftitle.errors;
+
+
+
+ divisor が負の場合、
+ ValueError がスローされます。
+
+
+
+
+ divisor が 0 の場合、
+ DivisionByZeroError がスローされます。
+
+
+
+
+
+
+ &reftitle.examples;
+
+ Time\Duration::divideBy の例
+
+divideBy(3)->multiplyBy(3));
+
+try {
+ \Time\Duration::fromSeconds(10)->divideBy(0);
+} catch (DivisionByZeroError $e) {
+ echo $e->getMessage(), PHP_EOL;
+}
+]]>
+
+ &example.outputs;
+
+
+ int(9)
+ ["nanoseconds"]=>
+ int(999999999)
+ ["negative"]=>
+ bool(false)
+}
+Division by zero
+]]>
+
+
+
+
+
+ &reftitle.seealso;
+
+ Time\Duration::multiplyBy
+ intdiv
+
+
+
+
+
diff --git a/reference/datetime/time/duration/fromhours.xml b/reference/datetime/time/duration/fromhours.xml
new file mode 100644
index 0000000000..8167e74ac4
--- /dev/null
+++ b/reference/datetime/time/duration/fromhours.xml
@@ -0,0 +1,121 @@
+
+
+
+
+
+ Time\Duration::fromHours
+ 時間数から期間を作成する
+
+
+
+ &reftitle.description;
+
+ public static Time\DurationTime\Duration::fromHours
+ inthours
+
+
+ hours 時間の、負でない期間を作成します。
+ 値は整数の秒数とナノ秒数に正規化されます。
+ Time\Duration::$seconds と
+ Time\Duration::$nanoseconds プロパティを参照ください。
+
+
+
+
+ &reftitle.parameters;
+
+
+ hours
+
+
+ 時間数。
+ 0 以上でなければなりません。
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ 新しい Time\Duration オブジェクトを返します。
+
+
+
+
+ &reftitle.errors;
+
+
+
+ hours が負の場合、
+ ValueError がスローされます。
+
+
+ &ext.datetime.duration-too-long;
+
+
+
+
+ &reftitle.examples;
+
+ Time\Duration::fromHours の例
+
+getMessage(), PHP_EOL;
+}
+]]>
+
+ &example.outputs;
+
+
+ int(86400)
+ ["nanoseconds"]=>
+ int(0)
+ ["negative"]=>
+ bool(false)
+}
+The maximum representable range is 9_223_372_035 seconds (roughly 292 years)
+]]>
+
+
+
+
+
+ &reftitle.seealso;
+
+ Time\Duration::fromSeconds
+ Time\Duration::fromMinutes
+ Time\Duration::fromIso8601DurationString
+
+
+
+
+
diff --git a/reference/datetime/time/duration/fromiso8601durationstring.xml b/reference/datetime/time/duration/fromiso8601durationstring.xml
new file mode 100644
index 0000000000..736065d922
--- /dev/null
+++ b/reference/datetime/time/duration/fromiso8601durationstring.xml
@@ -0,0 +1,181 @@
+
+
+
+
+
+ Time\Duration::fromIso8601DurationString
+ ISO 8601 の期間指定から期間を作成する
+
+
+
+ &reftitle.description;
+
+ public static Time\DurationTime\Duration::fromIso8601DurationString
+ stringspecification
+
+
+ PT1H30M のような
+ ISO 8601
+ の期間指定の時間部分から、負でない期間を作成します。
+
+
+
+
+ &reftitle.parameters;
+
+
+ specification
+
+
+ ISO 8601 の期間指定。
+ 書式は、period
を表す文字 P
+ で始まり、time
を表す文字 T
+ が続きます。さらに、整数値の後に間隔指示子を付けたものを 1 つ以上並べます:
+
+
+
+
+
+ 間隔指示子
+ 説明
+
+
+
+
+ H
+ 時間
+
+
+ M
+ 分
+
+
+ S
+ 秒
+
+
+
+
+
+ 間隔指示子は表の順に並べなければなりませんが、それぞれ省略できます。
+ 値は単位の通常の範囲を超えてもかまわないため、
+ PT90M と PT1H30M は同じ期間を表します。
+
+
+ 年、月、週、日は長さが一定ではないため、日付の間隔指示子
+ Y、M、W、D
+ は受け付けません。
+ PT0.5S のような小数の値もサポートしていません。
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ 新しい Time\Duration オブジェクトを返します。
+
+
+
+
+ &reftitle.errors;
+
+
+
+ specification を ISO 8601
+ の期間としてパースできない場合、
+ Time\TimeException がスローされます。
+
+
+
+
+ specification に日付の間隔指示子
+ (Y、M、W、D)
+ が含まれている場合、
+ Time\TimeException がスローされます。
+
+
+
+
+ specification が期間ではなく日付/時刻または時間間隔である場合、
+ Time\TimeException がスローされます。
+
+
+ &ext.datetime.duration-too-long;
+
+
+
+
+ &reftitle.examples;
+
+ Time\Duration::fromIso8601DurationString の例
+
+seconds);
+
+try {
+ \Time\Duration::fromIso8601DurationString('P1D');
+} catch (\Time\TimeException $e) {
+ echo $e->getMessage(), PHP_EOL;
+}
+
+try {
+ \Time\Duration::fromIso8601DurationString('PT0.5S');
+} catch (\Time\TimeException $e) {
+ echo $e->getMessage(), PHP_EOL;
+}
+]]>
+
+ &example.outputs;
+
+
+ int(5400)
+ ["nanoseconds"]=>
+ int(0)
+ ["negative"]=>
+ bool(false)
+}
+int(90)
+The ISO 8601 duration string may only contain the time (T) aspect
+The ISO 8601 duration string could not be parsed
+]]>
+
+
+
+
+
+ &reftitle.seealso;
+
+ Time\Duration::fromSeconds
+ Time\Duration::fromHours
+
+
+
+
+
diff --git a/reference/datetime/time/duration/frommicroseconds.xml b/reference/datetime/time/duration/frommicroseconds.xml
new file mode 100644
index 0000000000..29ab3324de
--- /dev/null
+++ b/reference/datetime/time/duration/frommicroseconds.xml
@@ -0,0 +1,113 @@
+
+
+
+
+
+ Time\Duration::fromMicroseconds
+ マイクロ秒数から期間を作成する
+
+
+
+ &reftitle.description;
+
+ public static Time\DurationTime\Duration::fromMicroseconds
+ intmicroseconds
+
+
+ microseconds マイクロ秒の、負でない期間を作成します。
+ 値は整数の秒数とナノ秒数に正規化されます。
+ Time\Duration::$seconds と
+ Time\Duration::$nanoseconds プロパティを参照ください。
+
+
+
+
+ &reftitle.parameters;
+
+
+ microseconds
+
+
+ マイクロ秒数。
+ 0 以上でなければなりません。
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ 新しい Time\Duration オブジェクトを返します。
+
+
+
+
+ &reftitle.errors;
+
+
+
+ microseconds が負の場合、
+ ValueError がスローされます。
+
+
+
+
+
+
+ &reftitle.examples;
+
+ Time\Duration::fromMicroseconds の例
+
+
+
+ &example.outputs;
+
+
+ int(1)
+ ["nanoseconds"]=>
+ int(500000000)
+ ["negative"]=>
+ bool(false)
+}
+]]>
+
+
+
+
+
+ &reftitle.seealso;
+
+ Time\Duration::fromSeconds
+ Time\Duration::fromNanoseconds
+ Time\Duration::fromMilliseconds
+
+
+
+
+
diff --git a/reference/datetime/time/duration/frommilliseconds.xml b/reference/datetime/time/duration/frommilliseconds.xml
new file mode 100644
index 0000000000..b08de5a2a5
--- /dev/null
+++ b/reference/datetime/time/duration/frommilliseconds.xml
@@ -0,0 +1,113 @@
+
+
+
+
+
+ Time\Duration::fromMilliseconds
+ ミリ秒数から期間を作成する
+
+
+
+ &reftitle.description;
+
+ public static Time\DurationTime\Duration::fromMilliseconds
+ intmilliseconds
+
+
+ milliseconds ミリ秒の、負でない期間を作成します。
+ 値は整数の秒数とナノ秒数に正規化されます。
+ Time\Duration::$seconds と
+ Time\Duration::$nanoseconds プロパティを参照ください。
+
+
+
+
+ &reftitle.parameters;
+
+
+ milliseconds
+
+
+ ミリ秒数。
+ 0 以上でなければなりません。
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ 新しい Time\Duration オブジェクトを返します。
+
+
+
+
+ &reftitle.errors;
+
+
+
+ milliseconds が負の場合、
+ ValueError がスローされます。
+
+
+
+
+
+
+ &reftitle.examples;
+
+ Time\Duration::fromMilliseconds の例
+
+
+
+ &example.outputs;
+
+
+ int(2)
+ ["nanoseconds"]=>
+ int(500000000)
+ ["negative"]=>
+ bool(false)
+}
+]]>
+
+
+
+
+
+ &reftitle.seealso;
+
+ Time\Duration::fromSeconds
+ Time\Duration::fromMicroseconds
+ Time\Duration::fromMinutes
+
+
+
+
+
diff --git a/reference/datetime/time/duration/fromminutes.xml b/reference/datetime/time/duration/fromminutes.xml
new file mode 100644
index 0000000000..fc73f2e8d0
--- /dev/null
+++ b/reference/datetime/time/duration/fromminutes.xml
@@ -0,0 +1,121 @@
+
+
+
+
+
+ Time\Duration::fromMinutes
+ 分単位の値から期間を作成する
+
+
+
+ &reftitle.description;
+
+ public static Time\DurationTime\Duration::fromMinutes
+ intminutes
+
+
+ minutes 分の、負でない期間を作成します。
+ 値は整数の秒数とナノ秒数に正規化されます。
+ Time\Duration::$seconds と
+ Time\Duration::$nanoseconds プロパティを参照ください。
+
+
+
+
+ &reftitle.parameters;
+
+
+ minutes
+
+
+ 分単位の値。
+ 0 以上でなければなりません。
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ 新しい Time\Duration オブジェクトを返します。
+
+
+
+
+ &reftitle.errors;
+
+
+
+ minutes が負の場合、
+ ValueError がスローされます。
+
+
+ &ext.datetime.duration-too-long;
+
+
+
+
+ &reftitle.examples;
+
+ Time\Duration::fromMinutes の例
+
+getMessage(), PHP_EOL;
+}
+]]>
+
+ &example.outputs;
+
+
+ int(5400)
+ ["nanoseconds"]=>
+ int(0)
+ ["negative"]=>
+ bool(false)
+}
+Time\Duration::fromMinutes(): Argument #1 ($minutes) must be greater than or equal to 0
+]]>
+
+
+
+
+
+ &reftitle.seealso;
+
+ Time\Duration::fromSeconds
+ Time\Duration::fromHours
+ Time\Duration::fromIso8601DurationString
+
+
+
+
+
diff --git a/reference/datetime/time/duration/fromnanoseconds.xml b/reference/datetime/time/duration/fromnanoseconds.xml
new file mode 100644
index 0000000000..6ad275c8bb
--- /dev/null
+++ b/reference/datetime/time/duration/fromnanoseconds.xml
@@ -0,0 +1,140 @@
+
+
+
+
+
+ Time\Duration::fromNanoseconds
+ ナノ秒数から期間を作成する
+
+
+
+ &reftitle.description;
+
+ public static Time\DurationTime\Duration::fromNanoseconds
+ intnanoseconds
+
+
+ nanoseconds ナノ秒の、負でない期間を作成します。
+ 値は整数の秒数とナノ秒数に正規化されます。
+ Time\Duration::$seconds と
+ Time\Duration::$nanoseconds プロパティを参照ください。
+
+
+
+
+ &reftitle.parameters;
+
+
+ nanoseconds
+
+
+ ナノ秒数。
+ 0 以上でなければなりません。
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ 新しい Time\Duration オブジェクトを返します。
+
+
+
+
+ &reftitle.errors;
+
+
+
+ nanoseconds が負の場合、
+ ValueError がスローされます。
+
+
+
+
+
+
+ &reftitle.examples;
+
+ Time\Duration::fromNanoseconds の例
+
+
+
+ &example.outputs;
+
+
+ int(1)
+ ["nanoseconds"]=>
+ int(500000000)
+ ["negative"]=>
+ bool(false)
+}
+]]>
+
+
+
+ hrtime で経過時間を計測する
+
+
+
+ &example.outputs.similar;
+
+
+ int(0)
+ ["nanoseconds"]=>
+ int(1062541)
+ ["negative"]=>
+ bool(false)
+}
+]]>
+
+
+
+
+
+ &reftitle.seealso;
+
+ Time\Duration::fromSeconds
+ Time\Duration::fromMicroseconds
+ Time\Duration::fromMilliseconds
+ hrtime
+
+
+
+
+
diff --git a/reference/datetime/time/duration/fromseconds.xml b/reference/datetime/time/duration/fromseconds.xml
new file mode 100644
index 0000000000..eac0cbbb6b
--- /dev/null
+++ b/reference/datetime/time/duration/fromseconds.xml
@@ -0,0 +1,155 @@
+
+
+
+
+
+ Time\Duration::fromSeconds
+ 秒数とナノ秒数から期間を作成する
+
+
+
+ &reftitle.description;
+
+ public static Time\DurationTime\Duration::fromSeconds
+ intseconds
+ intnanoseconds0
+
+
+ seconds 秒に
+ nanoseconds ナノ秒を足した、負でない期間を作成します。
+
+
+
+
+ &reftitle.parameters;
+
+
+ seconds
+
+
+ 整数の秒数。
+ 0 以上でなければなりません。
+
+
+
+
+ nanoseconds
+
+
+ 1 秒未満の端数 (ナノ秒単位)。
+ 0 以上 999999999
+ 以下でなければなりません。
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ 新しい Time\Duration オブジェクトを返します。
+
+
+
+
+ &reftitle.errors;
+
+
+
+ seconds が負の場合、
+ ValueError がスローされます。
+
+
+
+
+ nanoseconds が負の場合、
+ ValueError がスローされます。
+
+
+
+
+ nanoseconds が
+ 1000000000 以上の場合、
+ ValueError がスローされます。
+
+
+ &ext.datetime.duration-too-long;
+
+
+
+
+ &reftitle.examples;
+
+ Time\Duration::fromSeconds の例
+
+getMessage(), PHP_EOL;
+}
+]]>
+
+ &example.outputs;
+
+
+ int(90)
+ ["nanoseconds"]=>
+ int(0)
+ ["negative"]=>
+ bool(false)
+}
+object(Time\Duration)#2 (3) {
+ ["seconds"]=>
+ int(1)
+ ["nanoseconds"]=>
+ int(500000000)
+ ["negative"]=>
+ bool(false)
+}
+Time\Duration::fromSeconds(): Argument #2 ($nanoseconds) must be less than 1_000_000_000
+]]>
+
+
+
+
+
+ &reftitle.seealso;
+
+ Time\Duration::fromNanoseconds
+ Time\Duration::fromMicroseconds
+ Time\Duration::fromMilliseconds
+ Time\Duration::fromMinutes
+ Time\Duration::fromHours
+ Time\Duration::fromIso8601DurationString
+
+
+
+
+
diff --git a/reference/datetime/time/duration/multiplyby.xml b/reference/datetime/time/duration/multiplyby.xml
new file mode 100644
index 0000000000..05a726bfc4
--- /dev/null
+++ b/reference/datetime/time/duration/multiplyby.xml
@@ -0,0 +1,119 @@
+
+
+
+
+
+ Time\Duration::multiplyBy
+ 期間を整数倍する
+
+
+
+ &reftitle.description;
+
+ public Time\DurationTime\Duration::multiplyBy
+ intfactor
+
+
+ この期間を factor 倍した期間を返します。
+ 符号は維持されます。
+
+
+
+
+ &reftitle.parameters;
+
+
+ factor
+
+
+ 乗数。
+ 0 以上でなければなりません。
+ 0 の場合、結果は長さ 0 の期間になります。
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ 新しい Time\Duration オブジェクトを返します。
+
+
+
+
+ &reftitle.errors;
+
+
+
+ factor が負の場合、
+ ValueError がスローされます。
+
+
+ &ext.datetime.duration-too-long;
+
+
+
+
+ &reftitle.examples;
+
+ Time\Duration::multiplyBy の例
+
+multiplyBy(4));
+
+try {
+ \Time\Duration::fromHours(1)->multiplyBy(3_000_000);
+} catch (\Time\TimeException $e) {
+ echo $e->getMessage(), PHP_EOL;
+}
+]]>
+
+ &example.outputs;
+
+
+ int(6)
+ ["nanoseconds"]=>
+ int(0)
+ ["negative"]=>
+ bool(false)
+}
+The maximum representable range is 9_223_372_035 seconds (roughly 292 years)
+]]>
+
+
+
+
+
+ &reftitle.seealso;
+
+ Time\Duration::divideBy
+ Time\Duration::add
+
+
+
+
+
diff --git a/reference/datetime/time/duration/negate.xml b/reference/datetime/time/duration/negate.xml
new file mode 100644
index 0000000000..ccb61df380
--- /dev/null
+++ b/reference/datetime/time/duration/negate.xml
@@ -0,0 +1,90 @@
+
+
+
+
+
+ Time\Duration::negate
+ 符号を反転した期間を返す
+
+
+
+ &reftitle.description;
+
+ public Time\DurationTime\Duration::negate
+
+
+
+ 長さが同じで、符号を反転した期間を返します。
+ 正の期間は負に、負の期間は正になります。
+ 長さ 0 の期間は、符号を反転しても長さ 0 のままで、負になることはありません。
+
+
+
+
+ &reftitle.parameters;
+ &no.function.parameters;
+
+
+
+ &reftitle.returnvalues;
+
+ 新しい Time\Duration オブジェクトを返します。
+
+
+
+
+ &reftitle.examples;
+
+ Time\Duration::negate の例
+
+negate()->negative);
+var_dump($duration->negate()->negate()->negative);
+
+// 長さ 0 の期間には符号がありません。
+var_dump(\Time\Duration::fromSeconds(0)->negate()->negative);
+]]>
+
+ &example.outputs;
+
+
+
+
+
+
+
+ &reftitle.seealso;
+
+ Time\Duration::absolute
+ Time\Duration::sub
+
+
+
+
+
diff --git a/reference/datetime/time/duration/sub.xml b/reference/datetime/time/duration/sub.xml
new file mode 100644
index 0000000000..ffda684c91
--- /dev/null
+++ b/reference/datetime/time/duration/sub.xml
@@ -0,0 +1,117 @@
+
+
+
+
+
+ Time\Duration::sub
+ 期間を減算する
+
+
+
+ &reftitle.description;
+
+ public Time\DurationTime\Duration::sub
+ Time\Durationduration
+
+
+ この期間から duration を減算した期間を返します。
+ どちらの期間の符号も考慮されるため、正の期間から負の期間を減算すると、元の期間より長くなります。
+ duration がこの期間より大きい場合、結果は負になります。
+
+
+
+
+ &reftitle.parameters;
+
+
+ duration
+
+
+ 減算する期間。
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ 新しい Time\Duration オブジェクトを返します。
+
+
+
+
+ &reftitle.errors;
+
+ &ext.datetime.duration-too-long;
+
+
+
+
+ &reftitle.examples;
+
+ Time\Duration::sub の例
+
+sub(\Time\Duration::fromMilliseconds(2500)));
+
+// より大きな期間を減算すると、負の期間になります。
+var_dump(\Time\Duration::fromSeconds(1)->sub(\Time\Duration::fromSeconds(3)));
+]]>
+
+ &example.outputs;
+
+
+ int(7)
+ ["nanoseconds"]=>
+ int(500000000)
+ ["negative"]=>
+ bool(false)
+}
+object(Time\Duration)#1 (3) {
+ ["seconds"]=>
+ int(2)
+ ["nanoseconds"]=>
+ int(0)
+ ["negative"]=>
+ bool(true)
+}
+]]>
+
+
+
+
+
+ &reftitle.seealso;
+
+ Time\Duration::add
+ Time\Duration::negate
+ Time\Duration::absolute
+
+
+
+
+
diff --git a/reference/datetime/time/duration/unserialize.xml b/reference/datetime/time/duration/unserialize.xml
new file mode 100644
index 0000000000..7f728a510e
--- /dev/null
+++ b/reference/datetime/time/duration/unserialize.xml
@@ -0,0 +1,82 @@
+
+
+
+
+
+ Time\Duration::__unserialize
+ シリアライズされたデータから期間を復元する
+
+
+
+ &reftitle.description;
+
+ public voidTime\Duration::__unserialize
+ arraydata
+
+
+ data 引数の &array; を
+ Time\Duration オブジェクトにアンシリアライズします。
+ このメソッドは unserialize から呼び出されるもので、
+ 直接呼び出すためのものではありません。
+
+
+
+
+ &reftitle.parameters;
+
+
+ data
+
+
+ array 形式の、シリアライズされたデータ。
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ &return.void;
+
+
+
+
+ &reftitle.errors;
+
+ data が有効な期間を表していない場合、
+ Exception がスローされます。
+
+
+
+
+ &reftitle.seealso;
+
+ serialize
+ unserialize
+ マジックメソッド
+
+
+
+
+