Code review- keep timer offset to one second

pull/1108/head
sgallese 4 years ago
parent b2951a3475
commit 3e6a9181d6

@ -36,10 +36,15 @@ abstract class DateUtils {
private var startDayHourOffset: Int = 0
private var startDayMinuteOffset: Int = 0
/**
* Number of milliseconds in one second.
*/
const val SECOND_LENGTH: Long = 1000
/**
* Number of milliseconds in one minute.
*/
const val MINUTE_LENGTH: Long = 60 * 1000
const val MINUTE_LENGTH: Long = 60 * SECOND_LENGTH
/**
* Number of milliseconds in one hour.

@ -39,7 +39,7 @@ open class MidnightTimer @Inject constructor() {
@Synchronized fun onPause(): MutableList<Runnable>? = executor.shutdownNow()
@Synchronized fun onResume(delayOffsetInMillis: Long = DateUtils.MINUTE_LENGTH, testExecutor: ScheduledExecutorService? = null) {
@Synchronized fun onResume(delayOffsetInMillis: Long = DateUtils.SECOND_LENGTH, testExecutor: ScheduledExecutorService? = null) {
executor = testExecutor ?: Executors.newSingleThreadScheduledExecutor()
executor.scheduleAtFixedRate(
{ notifyListeners() },

Loading…
Cancel
Save