ConnorRigby

ConnorRigby

Nerves Core Team

I have a system in a project where an end user schedules something to happen. I use Process.send_after/3 to do the actual scheduling, i hadn’t really considered the accuracy of sending a message to yourself long in the future. (in this case about 24 hours). I noticed this morning that my message was received at 9:40 AM, when it was scheduled to run at 10:05.

I know how to fix this issue pretty easily. I was just wondering if anyone has hit this before, or if anyone knows what causes the skew?

FWIW this is a Nerves app deployed to an RPI3. It has no real time clock, so the time on the device skews by about a minute before ntpd fixes it. i don’t feel as if the timer otp application uses the system time internally tho does it?

Most Liked

outlog

outlog

quite interesting since the RPI is most likely one of very few places the BEAM runs without rtc.

send_after uses monotonic time, and afaik by default the BEAM runs with no time warp mode Time and Time Correction in Erlang — OTP 29.0.2 (erts 17.0.2)

my unqualified guess would be if the time skews in “wrong” direction, monotonic time will still increase (being monotonic, after all) - and you end up with way of accuracy..

I wonder if using(and calculating) the absolute monotonic time, using the :abs option provides better accuracy, or is still prone to this inaccuracy Process — Elixir v1.20.2

I’ve never quite understood how (especially the more modern) RPIs lacks rtc on the board..

so maybe try and check the time warp mode used by nerves, and try and use single time warp in the vm.args..

On an embedded system it is not uncommon that the system has no power supply, not even a battery, when it is shut off. The system clock on such a system is typically way off when the system boots. If no time warp mode is used, and the Erlang runtime system is started before OS system time has been corrected, Erlang system time can be wrong for a long time, centuries or even longer.
Time and Time Correction in Erlang — OTP 29.0.2 (erts 17.0.2)

Last Post!

ConnorRigby

ConnorRigby OP

Nerves Core Team

Very interesting. I will have a read through this.

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
water
I’m aware of 2 such projects, are there others? git: GitHub - team-alembic/realworld: A fullstack Phoenix LiveView application with back...
New
itzmidinesh
Hi all, I’m working on a Phoenix project where I need to make external HTTP requests and I’m trying to choose between Req and HTTPoison....
New
peck
Hi everyone. My team and I have been working on a fairly modest app based around video streaming and chat, but we’ve landed a customer t...
New
leoschweizer
Hi, we run different LLM models across a cluster, with each node loading a configurable subset. Model-specific queues let nodes consume ...
New
csmr
Hi all, I’m new here and would like to hear peoples views on my Elixir/Phoenix based game-engine! :smiley: Mutonex gamedesign was finish...
New
perzanko
Do we have maintainer of absinthe-graphql/dataloader here? We have a PR that we’d like to merge to the library. Relatively small additive...
New

Other Trending Topics Top

dominicletz
Hey there, I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first. ...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews