Fix lag printing

This commit is contained in:
Thomas Jager 2016-11-05 18:53:35 +01:00
parent fdbbdf33e3
commit 9e77c40650

View File

@ -200,7 +200,7 @@ func (irc *Connection) setupCallbacks() {
ns, _ := strconv.ParseInt(e.Message(), 10, 64) ns, _ := strconv.ParseInt(e.Message(), 10, 64)
delta := time.Duration(time.Now().UnixNano() - ns) delta := time.Duration(time.Now().UnixNano() - ns)
if irc.Debug { if irc.Debug {
irc.Log.Printf("Lag: %vs\n", delta) irc.Log.Printf("Lag: %.3f s\n", delta.Seconds())
} }
}) })
@ -215,6 +215,8 @@ func (irc *Connection) setupCallbacks() {
// 1: RPL_WELCOME "Welcome to the Internet Relay Network <nick>!<user>@<host>" // 1: RPL_WELCOME "Welcome to the Internet Relay Network <nick>!<user>@<host>"
// Set irc.nickcurrent to the actually used nick in this connection. // Set irc.nickcurrent to the actually used nick in this connection.
irc.AddCallback("001", func(e *Event) { irc.AddCallback("001", func(e *Event) {
irc.Lock()
irc.nickcurrent = e.Arguments[0] irc.nickcurrent = e.Arguments[0]
irc.Unlock()
}) })
} }