Skip to content

Commit

Permalink
Remove warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
kizitonwose committed Mar 24, 2020
1 parent a3fbf17 commit ef4027f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@file:Suppress("unused")
package com.kizitonwose.timeandroid

import android.os.Handler
Expand Down
1 change: 1 addition & 0 deletions time/src/main/kotlin/com/kizitonwose/time/Extensions.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@file:Suppress("unused")
package com.kizitonwose.time

import java.util.*
Expand Down
6 changes: 4 additions & 2 deletions time/src/main/kotlin/com/kizitonwose/time/Time.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.kizitonwose.time

import java.io.Serializable
import java.util.*
import kotlin.math.roundToLong

/**
* Created by Kizito Nwose on 14/10/2017
Expand All @@ -27,7 +29,7 @@ class Interval<out T : TimeUnit>(value: Number, factory: () -> T) : Serializable

val value = value.toDouble()

val longValue = Math.round(this.value)
val longValue = this.value.roundToLong()

val inDays: Interval<Day>
get() = converted()
Expand Down Expand Up @@ -90,7 +92,7 @@ class Interval<out T : TimeUnit>(value: Number, factory: () -> T) : Serializable
override fun hashCode() = inMilliseconds.value.hashCode()

override fun toString(): String {
val unitString = unit::class.java.simpleName.toLowerCase()
val unitString = unit::class.java.simpleName.toLowerCase(Locale.ENGLISH)
val isWhole = value % 1 == 0.0
return (if (isWhole) longValue.toString() else value.toString())
.plus(" ")
Expand Down

0 comments on commit ef4027f

Please sign in to comment.