Skip to content

Commit 5b86637

Browse files
committed
adding option to use system-time for time stamping worldmodel
1 parent b9db596 commit 5b86637

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

JvmClient/src/jvmMain/java/uuspaceagent/UUSeAgentState.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,17 @@ public class UUSeAgentState extends Iv4xrAgentState<Void> {
4545

4646
/**
4747
* SE does not seem to send time-stamp, so we will keep track the number of state-updates
48-
* as a replacement of time-stamp.
48+
* as a replacement of time-stamp. Alternatively, we can use system-time if the flag
49+
* useSystemTimeForTimeStamping below is turned-on.
4950
*/
5051
long updateCount = 0 ;
5152

53+
/**
54+
* If this flag is on, we will use system-time (expressed in current ms) as the time
55+
* stamp (instead of turn-nr). Default is false.
56+
*/
57+
public boolean useSystemTimeForTimeStamping = false ;
58+
5259
public UUSeAgentState(String agentId) {
5360
this.agentId = agentId ;
5461
}
@@ -133,7 +140,6 @@ public void updateState(String agentId) {
133140
newWom.elements.put(this.agentId, agentAdditionalInfo(agentObs)) ;
134141
WorldEntity inv = agentInventory(agentObs) ;
135142
newWom.elements.put(inv.id,inv) ;
136-
assignTimeStamp(newWom,updateCount) ;
137143

138144
// The obtained wom also does not include blocks observed. So we get them explicitly here:
139145
// Well, we will get ALL blocks. Note that S=some blocks may change state or disappear,
@@ -158,7 +164,13 @@ public void updateState(String agentId) {
158164
newWom.elements.put(e.getKey(), e.getValue()) ;
159165
}
160166
}
161-
// updating the count:
167+
// assigning a time-stamp and updating the count:
168+
if (useSystemTimeForTimeStamping) {
169+
assignTimeStamp(newWom,System.currentTimeMillis()) ;
170+
}
171+
else {
172+
assignTimeStamp(newWom,updateCount) ;
173+
}
162174
updateCount++ ;
163175

164176
if(navgrid.origin == null) {

0 commit comments

Comments
 (0)