javatime

coulomb.units.javatime
object javatime

Conversion methods between coulomb types and java.time types

Attributes

Source
time.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
javatime.type

Members list

Type members

Classlikes

object conversions

Conversion typeclasses between coulomb types and java.time types

Conversion typeclasses between coulomb types and java.time types

Attributes

Source
time.scala
Supertypes
class Object
trait Matchable
class Any
Self type

Extensions

Extensions

extension (duration: Duration)
def tToQuantity[V, U](using d2q: TruncatingDurationQuantity[V, U]): Quantity[V, U]

Convert a Duration to a coulomb Quantity using a truncating conversion

Convert a Duration to a coulomb Quantity using a truncating conversion

Type parameters

U

the desired unit type

V

the desired value type - integral

Attributes

Returns

the quantity object equivalent to the Duration

Example
val d: Duration = ...
// convert to an integral quantity of seconds
d.tToQuantity[Long, Second]
Source
time.scala
def toQuantity[V, U](using d2q: DurationQuantity[V, U]): Quantity[V, U]

Convert a Duration to a coulomb Quantity

Convert a Duration to a coulomb Quantity

Type parameters

U

the desired unit type

V

the desired value type

Attributes

Returns

the quantity object equivalent to the Duration

Example
val d: Duration = ...
// convert d to seconds
d.toQuantity[Double, Second]
Source
time.scala
extension [V, U](epochTime: EpochTime[V, U])
def toInstant(using e2i: EpochTimeInstant[V, U]): Instant

Convert an EpochTime value to a java.time Instant

Convert an EpochTime value to a java.time Instant

Attributes

Returns

the equivalent Instant value

Example
val e: EpochTime[Double, Hour] = ...
// convert to an equivalent java.time Instant
e.toInstant
Source
time.scala
extension (instant: Instant)
def tToEpochTime[V, U](using i2e: TruncatingInstantEpochTime[V, U]): EpochTime[V, U]

Convert a java.time Instant to an EpochTime value using a truncating conversion

Convert a java.time Instant to an EpochTime value using a truncating conversion

Type parameters

U

the desired unit type

V

a desired integral value type

Attributes

Returns

equivalent EpochTime value

Example
val i: Instant = ...
// convert i to an integer number of days from Jan 1, 1970
i.tToEpochTime[Long, Day]
Source
time.scala
def toEpochTime[V, U](using i2e: InstantEpochTime[V, U]): EpochTime[V, U]

Convert a java.time Instant to an EpochTime value

Convert a java.time Instant to an EpochTime value

Type parameters

U

the desired unit type

V

the desired value type

Attributes

Returns

equivalent EpochTime value

Example
val i: Instant = ...
// convert i to days from Jan 1, 1970
i.toEpochTime[Double, Day]
Source
time.scala
extension [V, U](quantity: Quantity[V, U])
def toDuration(using q2d: QuantityDuration[V, U]): Duration

Convert a coulomb Quantity to java.time.Duration

Convert a coulomb Quantity to java.time.Duration

Attributes

Returns

a Duration equivalent to the original Quantity

Example
val q: Quantity[Double, Minute] = ...
// convert to an equivalent Duration
q.toDuration
Source
time.scala