top | item 45798934

I Built a One File Edge Probe to Tell Me When Time Is Lying

47 points| boulevard | 3 months ago |physical-ai.ghost.io

7 comments

order

boulevard|3 months ago

Note: This is a sanity probe, not a time discipline tool. rtt/2 and browser timers can be noisy, so treat green/red as a hint, not truth, especially on congested factory networks.

butvacuum|3 months ago

Interesting, but why not use the timestamp baked into response headers? There's also domain.tld/cdn-cgi/trace for cloudflare. I don't know how cloudflare will take using that page for this though.

withinboredom|3 months ago

Cross-origin stuff doesn’t always let you get access to those headers and they may not always be there. Some web servers don’t put that there, some do. Some frameworks add them, some don’t.

gschizas|3 months ago

A simple (and stupid) /time.aspx in VB.NET, because that's what was easily available:

    <%
    Dim epochMilliseconds As Long = CLng((DateTime.UtcNow - New DateTime(1970, 1, 1)).TotalMilliseconds)
    Response.Write("{ ""epoch_ms"": " & epochMilliseconds & " }")
    %>
(you need to change "/time" to "/time.aspx" for the original HTML page to work)

boulevard|3 months ago

This is perfect, for completeness, you can extend it with CORS + no-store and ms epoch.