From f643521f1d20f5c1f68c3c40be672dc61cffbe91 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Wed, 17 May 2023 12:13:16 +1000 Subject: [PATCH] Fix overflow in average download rate --- cmd/torrent/download.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/torrent/download.go b/cmd/torrent/download.go index 0ec4b990..cb3ca583 100644 --- a/cmd/torrent/download.go +++ b/cmd/torrent/download.go @@ -357,12 +357,12 @@ func downloadErr(flags downloadFlags) error { err = ctx.Err() } clientConnStats := client.ConnStats() - log.Printf("average download rate: %v", - humanize.Bytes(uint64( - time.Duration( - clientConnStats.BytesReadUsefulData.Int64(), - )*time.Second/time.Since(started), - ))) + log.Printf( + "average download rate: %v/s", + humanize.Bytes(uint64(float64( + clientConnStats.BytesReadUsefulData.Int64(), + )/time.Since(started).Seconds())), + ) if flags.Seed { if len(client.Torrents()) == 0 { log.Print("no torrents to seed") -- 2.44.0