bloom-lang / bud

Prototype Bud runtime (Bloom Under Development)
http://bloom-lang.net
Other
854 stars 60 forks source link

Add support for reading current clock #185

Closed neilconway closed 13 years ago

neilconway commented 13 years ago

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).