diff --git a/src/device/input/parse/v01/config.go b/src/device/input/parse/v01/config.go index 178b1d9..4c62453 100644 --- a/src/device/input/parse/v01/config.go +++ b/src/device/input/parse/v01/config.go @@ -20,8 +20,11 @@ type ( } configUser struct { - Player int - Message string + Player int + Message string + Alias string + LastTSMS int64 + LastLag int64 } configPlayer struct { diff --git a/src/device/input/parse/v01/v01.go b/src/device/input/parse/v01/v01.go index f42d5e9..0041ec0 100644 --- a/src/device/input/parse/v01/v01.go +++ b/src/device/input/parse/v01/v01.go @@ -70,9 +70,16 @@ func (v01 *V01) Read() []button.Button { } func (v01 *V01) telemetry(msg message) { - if FlagDebug { - log.Printf("%s|%dms", msg.U, time.Now().UnixNano()/int64(time.Millisecond)-msg.T) + if v01.cfg.Users == nil { + v01.cfg.Users = map[string]configUser{} } + u := v01.cfg.Users[msg.U] + u.LastLag = time.Now().UnixNano()/int64(time.Millisecond) - msg.T + u.LastTSMS = msg.T + if FlagDebug { + log.Printf("%s|%dms", msg.U, u.LastLag) + } + v01.cfg.Users[msg.U] = u } func (v01 *V01) transform(msg message) message {