I'd like to record the wallclock time at which I've received a message. The naive approach is problematic:
log <= event {|e| [e, Time.now]}
because Time.now is volatile -- reevaluations of the rule will produce a different value. If I'd like to associate a single time with each event, I now need to do something ugly like use aggregation or negation.
It would be simpler to just provide a bud_clock method that returns the same value for the duration of a single Bud timestep. This is analogous to the current_timestamp concept in SQL (which returns the time @ start-of-transaction, at least in Postgres).
I'd like to record the wallclock time at which I've received a message. The naive approach is problematic:
because
Time.now
is volatile -- reevaluations of the rule will produce a different value. If I'd like to associate a single time with each event, I now need to do something ugly like use aggregation or negation.It would be simpler to just provide a
bud_clock
method that returns the same value for the duration of a single Bud timestep. This is analogous to thecurrent_timestamp
concept in SQL (which returns the time @ start-of-transaction, at least in Postgres).