-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reimplement script commands against hive script
Signed-off-by: Jussi Maki <[email protected]>
- Loading branch information
Showing
21 changed files
with
1,230 additions
and
731 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ var Cell = cell.Module( | |
|
||
cell.Provide( | ||
newHiveDB, | ||
ScriptCommands, | ||
), | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright Authors of Cilium | ||
|
||
package internal | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
) | ||
|
||
func PrettySince(t time.Time) string { | ||
return PrettyDuration(time.Since(t)) | ||
} | ||
|
||
func PrettyDuration(d time.Duration) string { | ||
ago := float64(d) / float64(time.Microsecond) | ||
|
||
// micros | ||
if ago < 1000.0 { | ||
return fmt.Sprintf("%.1fus", ago) | ||
} | ||
|
||
// millis | ||
ago /= 1000.0 | ||
if ago < 1000.0 { | ||
return fmt.Sprintf("%.1fms", ago) | ||
} | ||
// secs | ||
ago /= 1000.0 | ||
if ago < 60.0 { | ||
return fmt.Sprintf("%.1fs", ago) | ||
} | ||
// mins | ||
ago /= 60.0 | ||
if ago < 60.0 { | ||
return fmt.Sprintf("%.1fm", ago) | ||
} | ||
// hours | ||
ago /= 60.0 | ||
return fmt.Sprintf("%.1fh", ago) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.