// SPDX-License-Identifier: MIT
// Copyright (c) 2024-2026 Acme Corp.

export function formatRelative(timestamp: number): string {
    const seconds = (Date.now() - timestamp) / 1000;
    if (seconds < 60) return `${Math.floor(seconds)}s ago`;
    if (seconds < 3600) return `${Math.floor(seconds / 60)}m ago`;
    if (seconds < 86400) return `${Math.floor(seconds / 3600)}h ago`;
    return `${Math.floor(seconds / 86400)}d ago`;
}
