Skip to main content
Glama
AIDC-AI

pixelle-mcp-Image-generation

by AIDC-AI
time_util.py1.45 kB
# Copyright (C) 2025 AIDC-AI # This project is licensed under the MIT License (SPDX-License-identifier: MIT). def format_duration(duration_seconds: float) -> str: """ Convert seconds to a human-friendly time string Args: duration_seconds: Duration (seconds) Returns: Formatted time string, such as: 1h23m45s, 2m30s, 1.5s, 500ms """ if duration_seconds < 0: return "0ms" # Convert to milliseconds total_ms = int(duration_seconds * 1000) # If less than 1 second, display milliseconds if total_ms < 1000: return f"{total_ms}ms" # Convert to each time unit hours = int(duration_seconds // 3600) minutes = int((duration_seconds % 3600) // 60) seconds = duration_seconds % 60 # Build the time string time_parts = [] if hours > 0: time_parts.append(f"{hours}h") if minutes > 0: time_parts.append(f"{minutes}m") # For seconds, if there is a decimal part and the total duration is less than 10 seconds, keep 1 decimal place if seconds > 0: if duration_seconds < 10 and seconds != int(seconds): time_parts.append(f"{seconds:.1f}s") else: time_parts.append(f"{int(seconds)}s") # If there are no time parts (theoretically should not happen), return 0ms if not time_parts: return "0ms" return "".join(time_parts)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/AIDC-AI/Pixelle-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server