File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 4
4
"github.com/RoboCup-SSL/ssl-game-controller/internal/app/engine"
5
5
"github.com/RoboCup-SSL/ssl-game-controller/internal/app/state"
6
6
"github.com/golang/protobuf/ptypes"
7
+ "github.com/golang/protobuf/ptypes/duration"
7
8
"time"
8
9
)
9
10
@@ -99,10 +100,10 @@ func (g *MessageGenerator) StateToRefereeMessage(matchState *state.State) (r *st
99
100
* r .CommandTimestamp = g .commandTimestamp
100
101
* r .PacketTimestamp = uint64 (time .Now ().UnixNano () / 1000 )
101
102
* r .Stage = * matchState .Stage
102
- * r .StageTimeLeft = matchState .StageTimeLeft . Nanos / 1000
103
+ * r .StageTimeLeft = microseconds ( * matchState .StageTimeLeft )
103
104
* r .BlueTeamOnPositiveHalf = * matchState .TeamInfo (state .Team_BLUE ).OnPositiveHalf
104
105
r .NextCommand = mapCommand (matchState .NextCommand )
105
- * r .CurrentActionTimeRemaining = int32 ( matchState . CurrentActionTimeRemaining . Seconds ) * 1_000_000 + matchState .CurrentActionTimeRemaining . Nanos / 1000
106
+ * r .CurrentActionTimeRemaining = microseconds ( * matchState .CurrentActionTimeRemaining )
106
107
107
108
updateTeam (r .Yellow , matchState .TeamInfo (state .Team_YELLOW ))
108
109
updateTeam (r .Blue , matchState .TeamInfo (state .Team_BLUE ))
@@ -173,3 +174,7 @@ func unsigned(v int) uint32 {
173
174
}
174
175
return uint32 (v )
175
176
}
177
+
178
+ func microseconds (dur duration.Duration ) int32 {
179
+ return int32 (dur .Seconds )* 1_000_000 + dur .Nanos / 1000
180
+ }
You can’t perform that action at this time.
0 commit comments