What you are forgetting is that the getCurrentTime activity does is that it creates an object of type Calendar and it puts the values of the calendar as beliefs in the newly created object. It is as if the agent creates a new Calendar object with values for the calendar time at that moment in the simulation. The agent then still has to "read the calendar" so that it gets the beliefs. Here is the code for an agent that does this:
agent AgentReadCurrentTime memberof CalendarUtilGroup {
activities:
communicate getTimeBeliefs(Calendar time) {
max_duration: 1;
with: time;
about: receive(time.hour = ?),
receive(time.minute = ?),
receive(time.second = ?);
}
workframes:
workframe workframe_1 {
do {
Calendar startTime;
getCurrentTime(startTime);
getTimeBeliefs(startTime);
}
}
}
Here is the code for the getCurrentTime activity in the CalendarUtilGroup library:
group CalendarUtilGroup {
activities:
/**
* Creates or populates a Calendar object with its beliefs set to the
* current date and time based on the currently set or default
* time zone. In simulated mode the time will be initialized to
* the simulated date/time. In (distributed) real-time mode the
* actual system time is used.
*
* @return out a variable of type Calendar to which to either assign
* a newly created Calendar object if the variable is unbound
* or from which to retrieve the bound Calendar object in which
* to store the beliefs about the current time
*/
java getCurrentTime(Calendar out) {
class: "brahms.base.util.GetCurrentTimeActivity";
} // getCurrentTime
I attach the AgentViewer screen shots to show that the agent get the beliefs.
After the agent has the beliefs you can now create a workframe that logs the beliefs in a file or whatever.
Maarten.