Skip to content

Commit

Permalink
chore: add Mbps and Gbps for unit (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
r3inbowari authored May 9, 2024
1 parent 51ca6b0 commit df4df67
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions speedtest/unit.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ func SetUnit(unit UnitType) {
globalByteRateUnit = unit
}

func (r ByteRate) Mbps() float64 {
return float64(r) / 125000.0
}

func (r ByteRate) Gbps() float64 {
return float64(r) / 125000000.0
}

// Byte Specifies the format output byte rate
func (r ByteRate) Byte(formatType UnitType) string {
if r == 0 {
Expand Down

0 comments on commit df4df67

Please sign in to comment.