package com.gh.gamecenter.feature.exposure.time

import com.alibaba.android.arouter.launcher.ARouter
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IFixedRateJobHelperProvider

object TimeUtil {

    fun currentTimeMillis(): Long {
        val provider = ARouter.getInstance().build(RouteConsts.provider.fixedRateJobHelper)
            .navigation() as? IFixedRateJobHelperProvider
        return (provider?.getTimeDeltaBetweenServerAndClient() ?: 0) + System.currentTimeMillis()
    }

    fun currentTime(): Int {
        val provider = ARouter.getInstance().build(RouteConsts.provider.fixedRateJobHelper)
            .navigation() as? IFixedRateJobHelperProvider
        return (((provider?.getTimeDeltaBetweenServerAndClient() ?: 0) + System.currentTimeMillis()) / 1000).toInt()
    }

}