1
0
mirror of https://github.com/schollz/croc.git synced 2024-11-24 16:23:47 +03:00

fix types mismatched with transfer duration

This commit is contained in:
Mr. Joja 2017-10-25 00:28:41 -06:00
parent dd6cf4ba76
commit 414507ab1c

View File

@ -408,7 +408,8 @@ func (c *Connection) runClient() error {
return nil return nil
} }
fmt.Println("\nFile sent.") fmt.Println("\nFile sent.")
fmt.Printf("\nTransfered with an average speed of %s/s", humanize.Bytes(uint64(c.File.Size/time.Since(startTime)))) timeSinceStart:= time.Since(startTime) / time.Second
fmt.Printf("\nTransfered with an average speed of %s/s", humanize.Bytes(uint64(float64(c.File.Size)/float64(timeSinceStart))))
} else { // Is a Receiver } else { // Is a Receiver
if responses.notPresent { if responses.notPresent {
fmt.Println("Sender is not ready. Use -wait to wait until sender connects.") fmt.Println("Sender is not ready. Use -wait to wait until sender connects.")
@ -467,8 +468,8 @@ func (c *Connection) runClient() error {
} else { } else {
fmt.Printf("\nReceived file written to %s\n", path.Join(c.Path, c.File.Name)) fmt.Printf("\nReceived file written to %s\n", path.Join(c.Path, c.File.Name))
} }
timeSinceStart:= time.Since(startTime) / time.Second
fmt.Printf("\nTransfered with an average speed of %s/s", humanize.Bytes(uint64(c.File.Size/time.Since(startTime)))) fmt.Printf("\nTransfered with an average speed of %s/s", humanize.Bytes(uint64(float64(c.File.Size)/float64(timeSinceStart))))
} }
return nil return nil
} }