Skip to content

Commit 68fe496

Browse files
committed
Editorial: Inline ZeroTimeDuration
It now just returns 0. No need to have an operation for that. See: #2953
1 parent 36f1baa commit 68fe496

File tree

5 files changed

+7
-18
lines changed

5 files changed

+7
-18
lines changed

spec/duration.html

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,17 +1475,6 @@ <h1>
14751475
</emu-alg>
14761476
</emu-clause>
14771477

1478-
<emu-clause id="sec-zerotimeduration" type="abstract operation">
1479-
<h1>ZeroTimeDuration ( ): a time duration</h1>
1480-
<dl class="header">
1481-
<dt>description</dt>
1482-
<dd>It returns a time duration of zero length.</dd>
1483-
</dl>
1484-
<emu-alg>
1485-
1. Return 0.
1486-
</emu-alg>
1487-
</emu-clause>
1488-
14891478
<emu-clause id="sec-temporal-datedurationdays" type="abstract operation">
14901479
<h1>
14911480
DateDurationDays (
@@ -1528,7 +1517,7 @@ <h1>
15281517
1. Let _fractionalDays_ be _duration_.[[Date]].[[Days]] + DivideTimeDuration(_duration_.[[Time]], nsPerDay).
15291518
1. Let _days_ be RoundNumberToIncrement(_fractionalDays_, _increment_, _roundingMode_).
15301519
1. Let _dateDuration_ be ? AdjustDateDurationRecord(_duration_.[[Date]], _days_).
1531-
1. Return ! CombineDateAndTimeDuration(_dateDuration_, ZeroTimeDuration()).
1520+
1. Return ! CombineDateAndTimeDuration(_dateDuration_, 0).
15321521
1. Assert: TemporalUnitCategory(_unit_) is ~time~.
15331522
1. Let _divisor_ be the value in the "Length in Nanoseconds" column of the row of <emu-xref href="#table-temporal-units"></emu-xref> whose "Value" column contains _unit_.
15341523
1. Let _rounded_ be ? RoundTimeDurationToIncrement(_duration_.[[Time]], _divisor_ × _increment_, _roundingMode_).
@@ -1675,7 +1664,7 @@ <h1>
16751664
1. Let _didExpandCalendarUnit_ be *false*.
16761665
1. Let _resultDuration_ be _startDuration_.
16771666
1. Let _nudgedEpochNs_ be _startEpochNs_.
1678-
1. Set _resultDuration_ to ! CombineDateAndTimeDuration(_resultDuration_, ZeroTimeDuration()).
1667+
1. Set _resultDuration_ to ! CombineDateAndTimeDuration(_resultDuration_, 0).
16791668
1. Let _nudgeResult_ be Duration Nudge Result Record { [[Duration]]: _resultDuration_, [[NudgedEpochNs]]: _nudgedEpochNs_, [[DidExpandCalendarUnit]]: _didExpandCalendarUnit_ }.
16801669
1. Return the Record { [[NudgeResult]]: _nudgeResult_, [[Total]]: _total_ }.
16811670
</emu-alg>
@@ -1813,7 +1802,7 @@ <h1>
18131802
1. Let _beyondEnd_ be _nudgedEpochNs_ - _endEpochNs_.
18141803
1. If _beyondEnd_ &lt; 0, let _beyondEndSign_ be -1; else if _beyondEnd_ > 0, let _beyondEndSign_ be 1; else let _beyondEndSign_ be 0.
18151804
1. If _beyondEndSign_ ≠ -_sign_, then
1816-
1. Set _duration_ to ! CombineDateAndTimeDuration(_endDuration_, ZeroTimeDuration()).
1805+
1. Set _duration_ to ! CombineDateAndTimeDuration(_endDuration_, 0).
18171806
1. Else,
18181807
1. Set _done_ to *true*.
18191808
1. Set _unitIndex_ to _unitIndex_ - 1.

spec/plaindate.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ <h1>
898898
1. If CompareISODate(_temporalDate_.[[ISODate]], _other_.[[ISODate]]) = 0, then
899899
1. Return ! CreateTemporalDuration(0, 0, 0, 0, 0, 0, 0, 0, 0, 0).
900900
1. Let _dateDifference_ be CalendarDateUntil(_temporalDate_.[[Calendar]], _temporalDate_.[[ISODate]], _other_.[[ISODate]], _settings_.[[LargestUnit]]).
901-
1. Let _duration_ be ! CombineDateAndTimeDuration(_dateDifference_, ZeroTimeDuration()).
901+
1. Let _duration_ be ! CombineDateAndTimeDuration(_dateDifference_, 0).
902902
1. If _settings_.[[SmallestUnit]] is not ~day~ or _settings_.[[RoundingIncrement]] ≠ 1, then
903903
1. Let _isoDateTime_ be CombineISODateAndTimeRecord(_temporalDate_.[[ISODate]], MidnightTimeRecord()).
904904
1. Let _isoDateTimeOther_ be CombineISODateAndTimeRecord(_other_.[[ISODate]], MidnightTimeRecord()).

spec/plaindatetime.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,7 @@ <h1>
10001000
</dl>
10011001
<emu-alg>
10021002
1. If CompareISODateTime(_isoDateTime1_, _isoDateTime2_) = 0, then
1003-
1. Return ! CombineDateAndTimeDuration(ZeroDateDuration(), ZeroTimeDuration()).
1003+
1. Return ! CombineDateAndTimeDuration(ZeroDateDuration(), 0).
10041004
1. Let _diff_ be ? DifferenceISODateTime(_isoDateTime1_, _isoDateTime2_, _calendar_, _largestUnit_).
10051005
1. If _smallestUnit_ is ~nanosecond~ and _roundingIncrement_ = 1, return _diff_.
10061006
1. Let _destEpochNs_ be GetUTCEpochNanoseconds(_isoDateTime2_).

spec/plainyearmonth.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ <h1>
610610
1. Let _otherDate_ be ? CalendarDateFromFields(_calendar_, _otherFields_, ~constrain~).
611611
1. Let _dateDifference_ be CalendarDateUntil(_calendar_, _thisDate_, _otherDate_, _settings_.[[LargestUnit]]).
612612
1. Let _yearsMonthsDifference_ be ! AdjustDateDurationRecord(_dateDifference_, 0, 0).
613-
1. Let _duration_ be ! CombineDateAndTimeDuration(_yearsMonthsDifference_, ZeroTimeDuration()).
613+
1. Let _duration_ be ! CombineDateAndTimeDuration(_yearsMonthsDifference_, 0).
614614
1. If _settings_.[[SmallestUnit]] is not ~month~ or _settings_.[[RoundingIncrement]] ≠ 1, then
615615
1. Let _isoDateTime_ be CombineISODateAndTimeRecord(_thisDate_, MidnightTimeRecord()).
616616
1. Let _isoDateTimeOther_ be CombineISODateAndTimeRecord(_otherDate_, MidnightTimeRecord()).

spec/zoneddatetime.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,7 @@ <h1>
11181118
</dd>
11191119
</dl>
11201120
<emu-alg>
1121-
1. If _ns1_ = _ns2_, return ! CombineDateAndTimeDuration(ZeroDateDuration(), ZeroTimeDuration()).
1121+
1. If _ns1_ = _ns2_, return ! CombineDateAndTimeDuration(ZeroDateDuration(), 0).
11221122
1. Let _startDateTime_ be GetISODateTimeFor(_timeZone_, _ns1_).
11231123
1. Let _endDateTime_ be GetISODateTimeFor(_timeZone_, _ns2_).
11241124
1. If _ns2_ - _ns1_ &lt; 0, let _sign_ be -1; else let _sign_ be 1.

0 commit comments

Comments
 (0)