Galaxy Communicator Documentation:

How to use timestamps

License / Documentation home / Help and feedback

One of the important dimensions of developing multimodal applications is being able to tell when things happen, in order to coordinate multiple input gestures, for instance. Starting with version 4.0, we associate timestamps with message traffic to support this need.

In the Communicator infrastructure, a timestamp is associated with a new message when the Hub receives it. We do not create timestamps in the server, because we can't depend on the servers having synchronized time to a fine enough degree. While it's not completely accurate to perform the timestamping when the Hub receives a message (rather than when the message is sent), we do benefit from a forced serialization and a common time reference base. In other words, we're betting that network latency, in those situations where time synchronization is important, is less of an issue than non-synchronized hosts. It's not clear that there's another bet to make; the best-known time synchronization protocol, NTP, is only accurate to a granularity of seconds, which is fine for most applications, but too coarse for multimodal synchronization by at least two orders of magnitude.

When the Hub receives a new message, then, it creates a token and assigns a 64-bit float as the current UTC time (i.e., number of seconds, with a granularity of microseconds, since midnight, January 1, 1970). When the Hub a message associated with that token to a server, it transmits the token's creation time as part of the administrative information in the calling environment. This time can be retrieved by the server via the environment.

double GalSS_EnvGetTokenTimestamp(GalSS_Environment *env)
If env is an environment created by virtue of calling a dispatch function, this function returns the creation time of the token which led to the invocation of the dispatch function.

This functionality is also available to Hub programs; see the Builtin dispatch function hub_token_timestamp.

Sometimes, the server may want to send a new message to the Hub, but preserve the creation time of the environment it's writing through.

void GalSS_EnvInheritTokenTimestamp(GalSS_Environment *env)
If env has a  token creation time associated with it, this function causes all new messages sent through env to inherit the creation time of the originating token.

This functionality is also available when the Hub creates a new message; see the Builtin dispatch function call_program.

License / Documentation home / Help and feedback
Last updated May 27, 2002