Skip to content

Commit

Permalink
Merge branch 'dashpay' into dashpay-hide-entry-points
Browse files Browse the repository at this point in the history
  • Loading branch information
HashEngineering authored Mar 13, 2024
2 parents 057ff1c + e8b9a18 commit e1ce6bf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions wallet/src/de/schildbach/wallet/util/TimeUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import org.slf4j.LoggerFactory
import java.net.DatagramPacket
import java.net.DatagramSocket
import java.net.InetAddress
import java.net.SocketTimeoutException
import kotlin.jvm.Throws

private val log = LoggerFactory.getLogger("TimeUtils")
Expand Down Expand Up @@ -49,6 +50,7 @@ private var lastTimeSkew = 0L
@Throws(NullPointerException::class)
suspend fun getTimeSkew(force: Boolean = false): Long {
if (!force && (lastTimeWhenSkewChecked + 60 * 1000 > System.currentTimeMillis())) {
log.info("timeskew: {}; using last value", lastTimeSkew)
return lastTimeSkew
}
var networkTime: Long? = null
Expand Down Expand Up @@ -85,6 +87,7 @@ suspend fun getTimeSkew(force: Boolean = false): Long {
// swallow
}
}
log.info("timeskew: network time is $networkTime")
requireNotNull(networkTime)
}

Expand Down

0 comments on commit e1ce6bf

Please sign in to comment.