// Convert "HH:MM:SS" string to timestamp (seconds)
export function stringToTimestamp(timeStr) {
  const [h, m, s] = timeStr.split(':').map(Number);
  return h * 3600 + m * 60 + s;
}

// Convert timestamp (seconds) to "HH:MM:SS" string
export function timestampToString(timestamp) {
  const h = Math.floor(timestamp / 3600)
    .toString()
    .padStart(2, '0');
  const m = Math.floor((timestamp % 3600) / 60)
    .toString()
    .padStart(2, '0');
  const s = (timestamp % 60).toString().padStart(2, '0');
  return `${h}:${m}:${s}`;
}
