Centro Global de Herramientas
Idioma actual: Spanish
Volver a guías

Guía

Cómo detectar rápido un bug de segundos vs milisegundos

Checklist breve para identificar errores de unidad en timestamps.

Muchos bugs de timestamp se detectan en minutos si revisas primero la unidad. Así evitas ciclos largos de depuración.

Start with the visual digit test

Most seconds timestamps are 10 digits and milliseconds are 13 digits.

This quick check solves many issues before deeper debugging.

Use one expected real-world timestamp

Convert one value where you already know the event time.

If result year or hour is absurd, unit is likely wrong.

Check both conversion directions

Convert timestamp to date and date back to timestamp.

Round-trip checks expose hidden assumptions in parsing logic.

  • Run test in UTC view.
  • Run same value in local view.
  • Compare with backend log output.

Inspect JavaScript and backend defaults

JavaScript Date constructors often expect milliseconds.

Many backend stores and APIs use seconds by default, so integration points need explicit conversion.

Add a guardrail for future payloads

Document expected unit in schema and enforce it with validation checks.

A small validator can stop repeated bugs across services.

Great for

  • Dates unexpectedly near 1970.
  • Future dates far beyond expected range.
  • APIs and frontend showing different event times.
  • Reviewing suspicious timestamps in incident logs.

Digit length check saves time

Start with digit length, then confirm one known value in UTC and local time.

Herramientas relacionadas

Convertidor de Timestamps

Convierte en ambos sentidos entre segundos Unix, milisegundos Unix y texto legible.

Open Timestamp Converter

Más guías

Sigue explorando con otra guía breve sobre un flujo de trabajo relacionado.