MCPcopy Create free account
hub / github.com/V2RaySSR/RealityChecker / formatDuration

Function formatDuration

internal/batch/manager.go:389–401  ·  view source on GitHub ↗

formatDuration 格式化时间显示

(d time.Duration)

Source from the content-addressed store, hash-verified

387
388// formatDuration 格式化时间显示
389func formatDuration(d time.Duration) string {
390 if d < time.Millisecond {
391 return fmt.Sprintf("%.0fµs", float64(d.Nanoseconds())/1000)
392 } else if d < time.Second {
393 return fmt.Sprintf("%.0fms", float64(d.Nanoseconds())/1000000)
394 } else if d < time.Minute {
395 return fmt.Sprintf("%.2fs", d.Seconds())
396 } else {
397 minutes := int(d.Minutes())
398 seconds := int(d.Seconds()) % 60
399 return fmt.Sprintf("%dm%ds", minutes, seconds)
400 }
401}
402
403// sortByRecommendationStars 按推荐星级排序,1星在最上面,5星在最下面
404func (bm *Manager) sortByRecommendationStars(results []*types.DetectionResult) {

Callers 1

formatBatchReportMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected