Access to time

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Access to time

grampajohn
Administrator
Is the current time going to be a globally-accessible quantity, or do we have to always pass around some structure containing a joda-time object? Right now I'm looking at the problem of knowing what the current rate is for a particular tariff. I wanted to be able to query for a rate now or in the past or future, but I can see no way to express the concept "now" in this context.

Has anyone else thought about this problem yet?

John
Reply | Threaded
Open this post in threaded view
|

Re: Access to time

Carsten Block
Administrator
Good point.

I added a static method currentTimeslot() to timeslot, which returns the timeslot marked with "current = true" for the competition market with "current=true" (there also exists Competition.currentCompetition()).
Both static methods use a read-write hibernate query cache to speed-up lookup.


Hope that helps.

Carsten


Am 13.01.2011 um 04:17 schrieb grampajohn [via Power TAC Developers]:

Is the current time going to be a globally-accessible quantity, or do we have to always pass around some structure containing a joda-time object? Right now I'm looking at the problem of knowing what the current rate is for a particular tariff. I wanted to be able to query for a rate now or in the past or future, but I can see no way to express the concept "now" in this context.

Has anyone else thought about this problem yet?

John



View message @ http://power-tac-developers.975333.n3.nabble.com/Access-to-time-tp2246058p2246058.html
To start a new topic under Power TAC Developers, email [hidden email]
To unsubscribe from Power TAC Developers, click here.

Reply | Threaded
Open this post in threaded view
|

Re: Access to time

grampajohn
Administrator
I think there must be a better way to keep track of the time. This approach seems awkward, and does not support testing very well as far as I can see. Every other simulator I've worked with (quite a few, actually) had a "clock" abstraction of some kind at its core. That's where time should come from, in my opinion. Ideally, we would use a version of joda-time that replaces the system clock with the simulation clock, so you could just do new localDateTime and get the current simulation time.