MCPcopy Create free account
hub / github.com/Tron521/codex-console-temp / format_duration

Function format_duration

src/core/utils.py:444–466  ·  view source on GitHub ↗

格式化持续时间 Args: seconds: 秒数 Returns: 格式化的持续时间字符串

(seconds: int)

Source from the content-addressed store, hash-verified

442
443
444def format_duration(seconds: int) -> str:
445 """
446 格式化持续时间
447
448 Args:
449 seconds: 秒数
450
451 Returns:
452 格式化的持续时间字符串
453 """
454 if seconds < 60:
455 return f"{seconds}秒"
456
457 minutes, seconds = divmod(seconds, 60)
458 if minutes < 60:
459 return f"{minutes}分{seconds}秒"
460
461 hours, minutes = divmod(minutes, 60)
462 if hours < 24:
463 return f"{hours}小时{minutes}分"
464
465 days, hours = divmod(hours, 24)
466 return f"{days}天{hours}小时"
467
468
469def mask_sensitive_data(data: Union[str, Dict, List], mask_char: str = "*") -> Union[str, Dict, List]:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected