package com.develop.food.base.utils

object TimeUtil {

    fun getTimes(second: Int, dst: IntArray) {
        val h = (second / 3600)
        val m = second % 3600 / 60
        val s = second % 60
        dst[0] = h
        dst[1] = m
        dst[2] = s
    }

    fun formatTime(src: IntArray): String {

        var time = (src[0] * 3600 + src[1] * 60 + src[2]);
        if(time >= 91*60){
            var h = time / 3600;
            var m = time % 60;
            return "${if(h < 10) "0${h}" else h}:${if(m < 10) "0${m}" else m}";
        }else{

            var m = time / 60;
            var s = time % 60;

            return "${if(m < 10) "0${m}" else m}:${if(s < 10) "0${s}" else s}";

        }

//        val hStr = if (src[0] < 10) "0${src[0]}" else src[0].toString()
//        val mStr = if (src[1] < 10) "0${src[1]}" else src[1].toString()
//        val sStr = if (src[2] < 10) "0${src[2]}" else src[2].toString()
//        return if (src[0] > 0) {
//            "$hStr:$mStr"
//        }else {
//            "$mStr:$sStr"
//        }


    }
}