Skip to content

Commit

Permalink
restore Centis.toSeconds: BigDecimal
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Dec 31, 2024
1 parent 08ba841 commit a769b8f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/src/main/scala/Centis.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ object Centis extends RichOpaqueInt[Centis]:
def roundTenths: Int = (if centis > 0 then centis + 5 else centis - 4) / 10
def roundSeconds: Seconds = Seconds(Math.round(centis * 0.01f))

inline def millis: Long = centis * 10L
def toDuration: FiniteDuration = FiniteDuration(millis, MILLISECONDS)
inline def toSeconds: BigDecimal = java.math.BigDecimal.valueOf(centis, 2)
inline def millis: Long = centis * 10L
def toDuration: FiniteDuration = FiniteDuration(millis, MILLISECONDS)

def *~(scalar: Float): Centis = ofFloat(scalar * centis)
def /(div: Int): Option[Centis] = (div != 0).option(centis / div)
Expand Down

0 comments on commit a769b8f

Please sign in to comment.