iansmith / parigot

Develop as a monolith, deploy as microservices.
https://parigot.info
BSD 3-Clause "New" or "Revised" License
12 stars 1 forks source link

Now() should be added in the kernel code #5

Closed iansmith closed 1 year ago

iansmith commented 1 year ago

Now() needs to be under test code control, for easier testing of things that need to be done hourly, daily, every weekday, etc.

Need to add a Now() call in the kernel that works with a "SetNow()" that should be in the atlanta.test area.

Now() should be implemented using the normal sys call machinery, but should respect SetNow if anybody has set the current time. SetNow() probably needs a flag also that says "freeze time" or not. If freeze time is true, then the clock stops running until the next SetNow() time.

The Now() machinery needs to also make sure that the start time of a call is recorded as what Now returns and that this gets passed via the pctx mechanism to downstream calls. This will require that upon receiving a call, receivers need to probably store the Now() value as an offset inside the pctx and then use the pctx for generating a timestamp on any log messages.