//
//  TimeInterval+Ext.swift
//  TSLiveWallpaper
//
//  Created by nkl on 2025/1/18.
//

import Foundation

extension TimeInterval {
    var mmss: String {
        let minute = Int(self) / 60
        let second = Int(self) % 60
        return String(format: "%02d", minute) + ":" + String(format: "%02d", second)
    }

    var mmsshh: String {
        let hour = Int(self) / 3600
        let minute = (Int(self) % 3600) / 60
        let second = Int(self) % 60

        if hour > 0 {
            return String(format: "%02d:%02d:%02d", hour, minute, second)
        } else {
            return mmss
        }
    }

    var hhmmss: String {
        let hour = Int(self) / 3600
        let minute = (Int(self) % 3600) / 60
        let second = Int(self) % 60
        return String(format: "%02d:%02d:%02d", hour, minute, second)
    }
}
