From c173987d7be9c643548310839a6f118c1114ecf7 Mon Sep 17 00:00:00 2001 From: "Mr. Joja" Date: Tue, 24 Oct 2017 22:40:48 -0600 Subject: [PATCH] added file/folder transfer time --- connect.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/connect.go b/connect.go index 13808a6c..fc803280 100644 --- a/connect.go +++ b/connect.go @@ -212,6 +212,7 @@ func (c *Connection) runClient() error { "sender?": c.IsSender, }) + startTime:= time.Now() c.HashedCode = Hash(c.Code) var wg sync.WaitGroup @@ -407,6 +408,7 @@ func (c *Connection) runClient() error { return nil } fmt.Println("\nFile sent.") + fmt.Printf("\nTransfered with an average speed of %s/s", humanize.Bytes(uint64(c.File.Size/time.since(startTime)))) } else { // Is a Receiver if responses.notPresent { fmt.Println("Sender is not ready. Use -wait to wait until sender connects.") @@ -466,6 +468,7 @@ func (c *Connection) runClient() error { fmt.Printf("\nReceived file written to %s\n", path.Join(c.Path, c.File.Name)) } + fmt.Printf("\nTransfered with an average speed of %s/s", humanize.Bytes(uint64(c.File.Size/time.since(startTime)))) } return nil }