Think about the last time your train was late at home. Five minutes? Twenty? Cancelled with no explanation? Many of us learn to treat the timetable as a rough promise. You leave early, you pack a book, and you are pleasantly surprised when things go to plan.

Now picture a small station outside Tokyo on a November morning in 2017. A train on the Tsukuba Express line was due to leave at 9:44 and 40 seconds. It left at 9:44 and 20 seconds. As far as anyone knows, nobody missed it and nobody complained. The railway put out a formal apology anyway. The story went around the world as a joke about Japanese perfectionism.

But the joke hides a real question. How do you get a train system where 20 seconds counts as a mistake? There is no single trick. It is several ordinary things, stacked on top of each other.

A timetable written in seconds

The times on the station board are in minutes, like anywhere else. Behind them sits a working plan that the public never sees. Japanese railway planners draw it in steps of 10 or 15 seconds, depending on the company and the line. Every train has a slot, and every slot leaves room for the trains behind it.

The station is part of the plan too. On many platforms, painted marks show exactly where each door will open, and people line up at those marks and let everyone off before getting on. For the driver there is a matching set of signs along the platform, small boards that show where the front of the train should stop for a train of that length. Stop on the mark, and the doors open right in front of the waiting queues.

Those seconds matter more than you might think. On a line where trains come every couple of minutes, a crowded door or someone squeezing in at the last moment can cost ten seconds, and ten lost seconds at one station spreads down the line. So passengers who stand in the right place, and step aside to let people out, are quietly part of the timetable.

Pointing at nothing

If you ride at the front of a Japanese train, you may see the driver do something odd. They point at a signal, then at a speed gauge, and say something out loud to an empty cab.

Railway staff call it “pointing and calling”. It started on Japan’s railways more than a century ago and was in the rule book for crews on Japan’s state-run railways by 1913. You can glance at a signal a thousand times a day without really seeing it, but pointing at it and saying it out loud forces you to stop and check. A study by the old national railway found it could cut the chance of an accident to about a sixth, and the habit has since spread from trains to buses, factories and hospitals.

The point of a habit like this is that it still works on a tired day, when attention slips. You can see the same thinking at the end of the line. When a bullet train, the Shinkansen, arrives in Tokyo and turns round to head back out, cleaning crews get about seven minutes to clean the whole train before the next passengers board.

Building out the delays

Some of the precision was built into the track. The first Shinkansen line, opened in 1964, was not squeezed onto the old railway. It got its own tracks, so no slow freight train or local service can get in the way. And the main line between Tokyo and Osaka has no level crossings. Roads go over or under it, so a stalled car or a gate stuck open can never hold up a train.

The result shows in the numbers. In the 2016 business year, the company that runs that line said its bullet trains were, on average, 24 seconds behind schedule. That figure includes the days lost to heavy rain, snow and earthquakes.

Then there is what happens after a delay. Japan’s transport ministry publishes, line by line, how often the busiest Tokyo-area lines run late and what caused it, so that the railways can see where to work. Which station, which door, which minute? A late train becomes a problem to trace, not just bad luck.

All this pressure to be on time has a cost, and it has not always been small. In 2005, a commuter train near Osaka, running behind after overshooting a station, took a curve far too fast and crashed into an apartment building. 107 people died, including the driver. Investigators pointed to two things: a tight timetable, and the punishing retraining the company gave drivers who made mistakes, which may have been on the driver’s mind. A timetable this tight runs on people, and people can be pushed too hard.

Back to the 20 seconds

So why apologise for 20 seconds? Because in a system built like this, a train leaving early is not a small thing. Someone who planned their morning around 9:44 and 40 seconds, and trusted it, could watch the doors close in front of them. The apology is less about the seconds than about that trust.

That is the real answer to how Japan’s trains run on time. A plan drawn in seconds. Drivers and crews who check things out loud. Tracks built so nothing else can get in the way. Companies that treat every delay as something to fix. And millions of passengers who stand on the marks and expect the train to arrive when it says.

Next time you ride a train in Japan, watch the platform. The queue at the painted mark, the driver’s pointed finger, the doors opening right where people are waiting. It all looks as calm as the hush inside a Tokyo carriage, which makes it easy to miss how much work goes into those few seconds.