mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-19 04:01:35 +00:00
* style: apply SwiftFormat 0.62.1 rules Refs #103202 * ci: enforce deterministic Swift lint Refs #103202 * refactor: keep gateway connect lint-clean Refs #103202 * style: keep iOS typography checks warning-free * ci: route MLX Swift changes through pre-push * fix: preserve native i18n extraction after Swift cleanup * refactor: keep rebased Swift surfaces lint-clean * style: format latest Swift additions * chore: refresh native i18n inventory * style: keep generated Swift formatter-clean * fix: preserve node route invalidation callbacks * fix: keep native translation IDs stable * fix: retain native translation identifiers * fix: preserve translations across Swift source moves
24 lines
528 B
Swift
24 lines
528 B
Swift
import Foundation
|
|
|
|
enum DurationFormattingSupport {
|
|
static func conciseDuration(ms: Int) -> String {
|
|
if ms < 1000 {
|
|
return "\(ms)ms"
|
|
}
|
|
let s = Double(ms) / 1000.0
|
|
if s < 60 {
|
|
return "\(Int(round(s)))s"
|
|
}
|
|
let m = s / 60.0
|
|
if m < 60 {
|
|
return "\(Int(round(m)))m"
|
|
}
|
|
let h = m / 60.0
|
|
if h < 48 {
|
|
return "\(Int(round(h)))h"
|
|
}
|
|
let d = h / 24.0
|
|
return "\(Int(round(d)))d"
|
|
}
|
|
}
|