Saltar al contenido
GlobalTime

Documentación

Cómo usar GlobalTime

La documentación está disponible en portugués e inglés; a continuación, la versión en inglés.

Overview

GlobalTime shows the exact time in your time zone, synchronized with the server, and brings together time tools: world clock, time zone converter, full-screen clock, stopwatch, timer, Pomodoro, alarm clock, countdown, calendar with personal events, Brazilian holidays, sunrise and sunset, date calculators and a Unix timestamp converter.

Everything runs in the browser, free and without ads. Creating an account is optional and only serves to store your calendar events on the server (see Events and account).

Language and time zone

Language

Each language has its own address: /cronometro in Brazilian Portuguese, /en/cronometro in English, /es/cronometro in Spanish, and so on. On your first visit to a Portuguese address, the site takes you to the version in your browser's main language (the first one in your preferred languages), if GlobalTime offers it; otherwise the page stays in Brazilian Portuguese. An address with a language (such as /en/...) always opens in that language.

Available languages: Brazilian Portuguese, European Portuguese, English, Spanish, French, German, Italian, Dutch, Russian, Japanese, Simplified Chinese, Korean and Arabic (right to left). To switch, use the language selector in the footer: the page opens in the chosen language, and your choice is saved in this browser and applies on every visit.

Names of Brazilian holidays and observances stay in Portuguese, since they are proper names. This documentation is available in Portuguese and English.

Time zone

The time on the home page is shown in the time zone configured on your device, read with Intl.DateTimeFormat().resolvedOptions().timeZone. GlobalTime does not ask for your location to do this — and your device's time zone does not, by itself, reveal where you are.

To choose a different one, click the place name above the clock. Your choice is saved; select “Automatic” to go back to the device's time zone. When the displayed time zone has a different time, Brasília time appears just below the date.

Changing the time zone only changes how the time is displayed: the instant still comes from the clock synchronized with the server. The world clock, converter, alarm clock and countdown start from the chosen time zone.

Keyboard shortcuts

Press H (or ?) on any page to see its shortcuts; the “Keyboard shortcuts” button, in the footer and near the tool controls, does the same.

KeyActionWhere
SpaceStart, pause or resumeStopwatch, timer, Pomodoro
LRecord a lapStopwatch
RReset or restart (asks for confirmation when there is data to lose)Stopwatch, timer, Pomodoro
+Add 1 minuteTimer
NSkip to the next stagePomodoro
F / MFull screen / toggle digital and analogFull screen
Arrows, PageUp, PageDown, HomeChange day, change period and go back to todayCalendar
H or ?Show shortcutsAll
EscClose dialogs and exit modesAll

Shortcuts don't work while you are typing in a field or while a dialog is open, and they never use Ctrl, Alt or ⌘, so they don't conflict with the browser or the system. The letters work on any layout: on Cyrillic, Arabic or Korean keyboards, the physical position of the key is what counts. Resetting a stopwatch with laps (or with more than one minute measured) asks for confirmation.

How synchronization works

Your computer's or phone's clock may be running fast or slow. That's why GlobalTime compares your clock with the server's:

  1. The browser queries /api/hora, which returns the server time in milliseconds, with headers that forbid caching.
  2. Sending and receiving are measured with performance.now(), which doesn't change when someone adjusts the system clock.
  3. We assume the server read its clock halfway through the round trip: on arrival, the server time is the received value plus half the round-trip time.
  4. When the page opens, up to five measurements are taken; we use the one with the lowest latency, which is the least affected by network queuing.
  5. Between synchronizations, the time advances with performance.now() from that measurement.
  6. Every 10 minutes there is a new round (three measurements), and also when the tab becomes visible again after more than a minute, when the connection comes back and when the page is restored from history.
  7. Every 5 seconds, the progress of the internal timer is compared with that of the system clock; if they diverge by more than 2 seconds (sleep, clock adjustment), synchronization is redone immediately.
  8. Each query has a 5-second limit, and late responses never overwrite a newer measurement.

If the time server fails

  1. GlobalTime server (/api/hora), with millisecond resolution.
  2. HTTP Date header from a file on the site itself: 1-second resolution; the server is retried every minute.
  3. Your device's clock, uncorrected, if nothing responds. If a previous synchronization succeeded, the clock stays corrected by it.

Accuracy and clock states

On the home page, the state appears discreetly in the top-right corner of the clock. Click it to open the Clock accuracy dialog: source used, latency, how far off your clock is and the estimated uncertainty — half the round-trip time, the largest error the network could have caused assuming the server is correct.

It is not a guarantee of absolute accuracy: the server clock (Vercel) is kept by NTP and is not an official atomic time source; the estimate assumes both legs of the round trip take the same time; and the screen only changes when the browser draws a new frame. Differences of up to 0.1 s are shown as “accurate”.

States

StateMeaning
Syncing…Measuring the difference between your clock and the server.
SyncedTime corrected by the GlobalTime server.
Limited accuracyServer unavailable; using the HTTP Date header.
Using device clockNo source responded; device time, uncorrected.
Offline · last syncNo internet, still corrected by the last synchronization.
OfflineNo internet and no previous synchronization.

Time zones

Times in other cities are calculated with the official time zone database (IANA) built into the browser, through the Intl.DateTimeFormat API — never by adding fixed hours —, so each place's daylight saving time rules are respected. Brazil has not observed daylight saving time since 2019.

  • World clock: starts with a few cities based on your time zone; add, reorder and remove cities. The list is saved in this browser.
  • Converter: converts a time between cities or IANA time zones, warns about nonexistent or repeated times at daylight saving transitions and includes a meeting planner.
  • Full screen: a large clock for TVs and monitors, with extra time zones; the settings are kept in the page address.

Stopwatch

Measures time with performance.now() during the session, so it is not affected by system clock adjustments. Record laps with L; the list shows each lap's time, the difference from the previous one and the total, and highlights the best and worst. It scrolls on its own, so it doesn't stretch the page.

Copy the results or export a CSV (; separator, with columns in exact milliseconds). If the page is reloaded, the stopwatch continues where it left off.

Timer and Pomodoro

The countdown is calculated from the end instant, not by subtracting seconds: the remaining time stays correct even if the browser throttles the tab in the background. When it ends, the chosen sound plays (for up to 5 minutes if “Repeat” is on) and, if you allowed it, a system notification appears. If the page was closed, it tells you when the time ran out.

The Pomodoro alternates focus, short break and long break with adjustable durations and keeps the day's history in this browser. Sound, notifications and “keep the screen on” are in collapsible sections.

Alarm clock and countdown

Alarms use the synchronized time and can have a date, weekly repetition, time zone and sound. They only ring while the page is open: with the tab or browser closed, nothing rings, and phones may suspend background tabs. For important appointments, also use your device's alarm clock.

The countdown shows how much time is left until a date in any time zone and generates a link to share. Saved countdowns appear in the calendar.

Calculators, timestamp and sun

  • Calculators: difference between dates (with business days excluding national holidays and, if selected, state holidays), adding calendar or business days, duration between times and unit conversion.
  • Unix timestamp: converts seconds or milliseconds into dates (ISO 8601, UTC and in the chosen time zone) and the other way around.
  • Sunrise and sunset: calculated with the NOAA algorithm for cities or coordinates. Your location is only requested if you click “Use my location”, and the coordinates never leave the browser.

Calendar

The calendar opens on the whole year, with the 12 months in a grid. Use the Year, Month and Week buttons to switch views; the selected date is kept. The arrows move forward or back one period and “Today” returns to the current period. Click a month's name to open it.

National, state and selected-capital holidays, optional federal holidays (pontos facultativos), observances, your countdowns and your events appear in every view. The side panel shows the details of the selected day.

Events and account

Create events with a title, date, optional time and description, and the “Repeat every year” option, for birthdays (February 29 appears on February 28 in non-leap years). Edit or delete them from the day panel; double-clicking a day (or pressing Enter) creates an event on it.

Without an account

Events are stored only in this browser (local storage). Clearing the site's data removes them.

With an account

With an email and password, events are stored on the server and appear on any device you sign in on. When you sign in, GlobalTime offers to move the events that were only in the browser to your account.

  • The password is stored with scrypt and a random salt; the server never stores the password itself.
  • The session uses an HttpOnly, SameSite=Lax and Secure cookie, valid for 30 days.
  • Sign-in attempts are rate-limited, and each account can only access its own events.
  • There is no password recovery by email yet. You can delete your account and all its events at any time by confirming your password.

Holiday data

The data was compiled on October 19, 2026 from official laws and calendars; each date includes its legal basis and source.

  • National: Brazilian Law nº 662/1949 (as amended by Lei nº 10.607/2002), Brazilian Law nº 6.802/1980 and Brazilian Law nº 14.759/2023 (November 20, a national holiday since 2024).
  • Optional federal holidays (pontos facultativos) are not holidays: they apply to the federal public administration (in 2026, Portaria MGI nº 11.460/2025).
  • Movable dates (Carnaval, Sexta-feira Santa, Páscoa, Corpus Christi) are calculated from Easter.
  • State: verified for 24 Brazilian states/federal units; MG, MT and PR have no state holiday of their own.
  • Municipal: only 21 state capitals with a law located. Check with your city hall.

Using it offline

GlobalTime is an installable web app (PWA). After the first visit, pages, styles, fonts, translations and scripts are stored, and the tools that don't depend on the network work offline.

Synchronization requires internet and is never cached — a stored time would be a wrong time. Accounts and events stored in an account also require a connection. When a new version is available, the “Update” notice appears.

Browser permissions

  • Sound: only allowed after an interaction, so it is prepared when you click Start.
  • Notifications: requested only when you click Enable.
  • Keep the screen on: available in some browsers; released when the tab is hidden and requested again when it returns.
  • Full screen: only by click or key press; Esc exits.
  • Location: used only for sunrise and sunset, and only if you ask.

Privacy

  • No ads, trackers or audience analytics. Fonts and icons are served from the site itself.
  • Preferences (language, theme, time zone), stopwatches, alarms, cities, history and events without an account are kept in the browser's localStorage.
  • The language chosen in the selector is also kept in the gt_idioma cookie (just the language code, for one year), so the site opens straight in the right version.
  • With an account, the server stores only your email, your protected password and your events.
  • The time query sends no personal data or cookies.

Project structure

A static site in plain HTML, CSS and JavaScript, with no build step and no production dependencies, plus Vercel Functions in api/.

  • *.html — pages; header, footer and metadata are maintained by dev/gerar.mjs from dev/site.mjs.
  • scripts/nucleo/ — DOM-free logic (time, synchronization, calendar, events) and components.
  • scripts/paginas/ — one script per page. scripts/i18n/ — languages and translations.
  • api/hora.js, api/conta.js, api/eventos.js — functions; helpers in api/_lib/.
  • sw.js — service worker (generated precache).

Running and testing

Requires Node.js 20 or later; there are no packages to install.

npm run dev              # http://localhost:3000
npm run gerar            # updates header, footer, texts, sitemap and service worker
npm run checar           # fails if anything is out of date
npm test                 # unit and function tests
npm run test:navegador   # all pages in Chrome/Edge (desktop and mobile)
npm run test:pwa         # service worker and offline use

On the local server, accounts use in-memory storage (cleared on restart). Browser test options: SO=/cronometro (a single page), FUSO=Asia/Tokyo, TEMA=dark and INTEIRA=1 (full-page screenshot).

Deploying to Vercel

The project is deployed to Vercel as is. User accounts require a Redis database: create an Upstash Redis database from the Vercel Marketplace (there is a free plan) and connect it to the project. Vercel creates the variables:

KV_REST_API_URL=…
KV_REST_API_TOKEN=…

The names UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN are also accepted. Without these variables the site works normally and events stay only in the browser. Set SITE_URL when running npm run gerar to the public address used in the sitemap.

API

GET /api/hora

Returns the server time in milliseconds, uncached.

curl https://YOUR-DOMAIN/api/hora
# {"timestamp":1792519155792}

/api/conta

GET reports whether accounts are available and which account is signed in. POST with acao set to cadastrar, entrar or sair; DELETE with the password deletes the account. Requests that change data require JSON and the same origin.

await fetch("/api/conta", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ acao: "entrar", email: "you@example.com", senha: "…" }),
});

/api/eventos

With an active session: GET lists, POST creates, PUT ?id= updates and DELETE ?id= deletes. Fields: titulo, data (AAAA-MM-DD), hora (HH:MM, optional), descricao and anual.

await fetch("/api/eventos", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ titulo: "Birthday", data: "2026-03-14", anual: true }),
});

Translations

Texts live in scripts/i18n/textos/: pt-BR.js is the reference, and each language has a file with the same keys (the tests check this). In the HTML, elements with data-i18n are filled in Portuguese by the generator and translated in the browser; in scripts, use t("chave", { parametros }). To add a language, add it to scripts/i18n/idiomas.js and create its texts file.