Fix timing format to correctly handle microsecond portion of time delta (#448)

This commit is contained in:
Yachen Mao 2024-10-15 14:48:41 +08:00 committed by GitHub
parent 9ff7bde222
commit 5ef0d03cb8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -60,7 +60,7 @@ func (l *filePtyLogger) loggingTty(msg []byte) ([]byte, error) {
delta := now.Sub(l.oldtime)
// see term-utils/script.c
fmt.Fprintf(l.timing, "%v.%06v %v\n", int64(delta/time.Second), int64(delta/time.Microsecond), len(buf))
fmt.Fprintf(l.timing, "%v.%06v %v\n", int64(delta/time.Second), int64(delta%time.Second/time.Microsecond), len(buf))
l.oldtime = now