🛠️ToolsShed

대역폭 계산기

대역폭으로 파일 전송 시간을, 또는 파일 크기와 목표 시간으로 필요 속도를 계산합니다.

자주 묻는 질문

코드 구현

def calculate_transfer_time(file_size_mb: float, bandwidth_mbps: float) -> float:
    """Calculate transfer time in seconds."""
    # Convert MB to Mb (1 byte = 8 bits)
    file_size_mb_bits = file_size_mb * 8
    return file_size_mb_bits / bandwidth_mbps

def format_time(seconds: float) -> str:
    if seconds < 60:
        return f"{seconds:.1f} seconds"
    elif seconds < 3600:
        return f"{seconds / 60:.1f} minutes"
    else:
        return f"{seconds / 3600:.1f} hours"

# Example: 500 MB file at 100 Mbps
file_size = 500   # MB
bandwidth = 100   # Mbps
time = calculate_transfer_time(file_size, bandwidth)
print(f"Transfer time: {format_time(time)}")  # 40.0 seconds

# With network overhead (assume 85% efficiency)
efficiency = 0.85
effective_time = time / efficiency
print(f"With overhead: {format_time(effective_time)}")  # ~47.1 seconds

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.