Skip to content

Commit

Permalink
Reinstate symbolic methods
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Oct 8, 2023
1 parent 424e615 commit c9c7bbe
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/core/time.scala
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ object Dates:
def addDays(count: Int): Date = date + count

infix def at(time: Time)(using Calendar): Timestamp = Timestamp(date, time)

@targetName("plus")
def +(period: Period)(using Calendar): Date = Date.plus(date, period)

export Dates.Date

Expand Down Expand Up @@ -238,6 +241,12 @@ object Timing:

def tai: TaiInstant = LeapSeconds.tai(instant)

@targetName("plus")
def +(duration: Duration): Instant = Instant.plus(instant, duration)

@targetName("minus")
def -(duration: Instant): Duration = Instant.minus(instant, duration)

infix def in(using RomanCalendar)(timezone: Timezone): LocalTime =
val zonedTime = jt.Instant.ofEpochMilli(instant).nn.atZone(jt.ZoneId.of(timezone.name.s)).nn

Expand Down Expand Up @@ -360,6 +369,12 @@ extends DiurnalPeriod, TemporalPeriod:
@targetName("times")
def *(n: Int): Period = Period(years*n, months*n, days*n, hours*n, minutes*n, seconds*n)

@targetName("plus")
def +(right: Period): Period = Period.plus(this, right)

@targetName("minus")
def -(right: Period): Period = Period.minus(this, right)

extension (one: 1)
def year: Timespan = Period(StandardTime.Year, 1)
def month: Timespan = Period(StandardTime.Month, 1)
Expand Down
1 change: 0 additions & 1 deletion src/core/timezone.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package aviation
import gossamer.*
import kaleidoscope.*
import anticipation.*
import symbolism.*
import spectacular.*
import eucalyptus.*
import rudiments.*
Expand Down

0 comments on commit c9c7bbe

Please sign in to comment.