VicroCode
Make Code Create Value
VicroCode is a lightweight online platform for publishing, running, sharing, and monetizing code projects. Launch HTML, Python, SQLite, AI agents, management tools, games, and more without server setup.
Please wait while VicroCode loads. You can also explore the AI programming guide
Loading...

AI MARKET GUIDE

Stop Letting the Model Guess Midnight: Host a Deterministic Time-Resolution Engine Instead

LLMs fumble solar-term cutovers, true solar time, and DST rollbacks. Here's a hosted Python engine that turns a messy local clock time into one canonical timestamp.

A bilingual Chinese-metaphysics site called Xiaodao wrote up something that reads less like a divination post and more like a time-handling postmortem, and the lesson generalizes far past BaZi charts. Their observation: ask Claude or ChatGPT to convert a birth time, and on ordinary dates it's usually fine. Push it onto a boundary, a solar-term cutover, a birthplace's true solar time, a historical daylight-saving switch, the 23:00 late-hour day-change, and it starts guessing. The dates where the answer actually matters are exactly the ones a language model gets wrong.

That's the signal worth stealing. Not the fortune-telling, the architecture decision underneath it: pull the deterministic time math out of the model entirely and hand the model a single clean timestamp.

Why do time boundaries break language models?

The failure isn't that the model is dumb about calendars. It's that local clock time is genuinely ambiguous, and the model resolves the ambiguity by vibes.

Four boundaries show up in the evidence, and each is a different trap. The year and month pillars switch at the instant the sun hits a 24-solar-term point, which is a globally fixed moment that does not shift with the birthplace's longitude. The day and hour pillars, by contrast, depend on where the sun actually sits in the sky, so they need a true-solar-time correction derived from the city's longitude and that day's equation of time. Mixing those two rules up is the classic error, and so is the double-correction bug the Xiaodao writeup calls out directly: the user already subtracted an hour in their head, then the program subtracts another.

Then there's daylight saving. Mainland China ran DST for six years, 1986 through 1991. 1986 started on May 4; 1987 to 1991 each started on the first Sunday in mid-April (1988 was April 17) and ended on the first Sunday in mid-September. Plenty of regions overseas still switch twice a year. The nastiest case is the autumn roll-back, when the same wall-clock hour happens twice in one night. A bare timestamp can't tell you which one the person meant, so the only honest move is to stop and ask: first pass, before the clock was turned back, or second pass, after.

Miss any of these by a few minutes near a solar-term edge and you don't just get the month pillar wrong; the downstream luck-cycle direction and starting age can be off by years.

Why is the resolver the asset, not the chart?

Here's the reframe for a solo builder or small team. The valuable, reusable thing is a function with a boring signature: ambiguous local clock time plus a city in, one canonical timestamp out. Everything interesting about reliability lives in that function, and none of it should live in a prompt.

You can build and run Python online on VicroCode to host exactly that resolver. Python is the right tool here because the logic is arithmetic and lookups, not generation: apply the longitude offset, apply the equation-of-time correction for the date, check whether the local date falls inside a DST window, and flag the ambiguous roll-back hour instead of silently picking one.

The rules those checks depend on are data, and data drifts. Historical DST windows have exceptions, and longitude tables always need a human to fix an outlier city. Keep them in a SQLite database, one table of city longitudes and one of DST rules, and give yourself a SQLite editor so corrections are a row edit rather than a redeploy. That hand-correctability is the point. When someone reports that a specific city or a specific 1988 date resolves wrong, you want to patch the row, not ship code.

For people who just want the answer, put a thin public calculator in front of it. You can run HTML online to host a page that takes the clock time and city, calls the Python backend, and shows the resolved timestamp along with a plain-language note whenever the input lands on a boundary, so the user sees both readings and decides. Mirroring Xiaodao's disambiguation popup, where they make the user confirm first-pass or second-pass on a roll-back night, is good practice: surface the fork, don't bury it.

How do you make the model call a resolver instead of guessing?

The last piece is what turns this from a web form into infrastructure. Expose the resolver as a callable endpoint so the model stops doing the math itself and asks your service for the canonical timestamp, then reasons over the clean value.

On VicroCode that maps to API Endpoint Hosting and in-platform tool calls. One caveat on scope: the source project ships this as a remote MCP server, and MCP as a specific protocol is not among the capabilities I can confirm here, so treat that detail as out of bounds and build against the endpoint hosting and tool-call surface that is confirmed. If you want a chat-driven layer on top, a model already offered through the platform's Model Center can handle the conversation while your endpoint owns the one thing it must never improvise.

I haven't measured accuracy against the Xiaodao implementation, so any claim that this approach is more correct than a raw LLM is unverified until you test it on your own boundary cases. The design argument stands on its own, though: deterministic work belongs in deterministic code, and a timestamp is deterministic work. Give the model the answer and let it do what it's actually good at.

If you publish the calculator and the endpoint, you've also got a self-contained thing to host, share, and monetize, which is the honest end state for a small tool like this.

FAQ

Why do LLMs get midnight and DST wrong?

Because date boundaries are deterministic rules, not language. The model reproduces plausible arithmetic instead of consulting a calendar, so transitions drift.

What is the fix?

Move the rule into code: a deterministic resolver endpoint the model calls, so the answer is a table lookup rather than a guess.

Is the chart the product?

No. The resolver is. Charts are easy to copy once the deterministic layer exists.

Further reading