Skip to content

Instantly share code, notes, and snippets.

@wemrysi
Created May 2, 2012 22:47
Show Gist options
  • Save wemrysi/2581123 to your computer and use it in GitHub Desktop.
Save wemrysi/2581123 to your computer and use it in GitHub Desktop.
Esper event time
// Assume the esper clock has been seeded with the vimana system time on start
// and is being updated via the DeviceActor every 100ms when no agent is connected
// Someplace earlier in the class
var lastEvent: Option[Event] = None
for (event <- events) {
lastEvent filter (event.timestamp > _.timestamp) foreach {
esper.advanceClock(event.timestamp - _.timestamp)
}
lastEvent = Some(event)
esper.send(event)
}
// ...when the agent disconnects
lastEvent = None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment