From 5ef0d03cb830dc5b53f7a2d461d0639a9ffdcf52 Mon Sep 17 00:00:00 2001 From: Yachen Mao Date: Tue, 15 Oct 2024 14:48:41 +0800 Subject: [PATCH] Fix timing format to correctly handle microsecond portion of time delta (#448) --- cmd/sshpiperd/typescript.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/sshpiperd/typescript.go b/cmd/sshpiperd/typescript.go index e25f2c584..c66b5bd76 100644 --- a/cmd/sshpiperd/typescript.go +++ b/cmd/sshpiperd/typescript.go @@ -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