Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
elvis972602 committed Feb 14, 2023
1 parent 9c625d6 commit f5ff851
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions utils/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ const (
TB
)

const (
Nanosecond = 1
Microsecond = 1000 * Nanosecond
Millisecond = 1000 * Microsecond
Second = 1000 * Millisecond
Minute = 60 * Second
Hour = 60 * Minute
)

func FormatSize(size int64) string {

switch {
Expand Down Expand Up @@ -71,15 +80,6 @@ func ParseSize(size string) int64 {
}

func FormatDuration(duration int64) string {
const (
Nanosecond = 1
Microsecond = 1000 * Nanosecond
Millisecond = 1000 * Microsecond
Second = 1000 * Millisecond
Minute = 60 * Second
Hour = 60 * Minute
)

switch {
case duration >= Hour:
return fmt.Sprintf("%.2dh%.2fm", duration/Hour, float64(duration%Hour)/Minute)
Expand Down

0 comments on commit f5ff851

Please sign in to comment.