utility

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DurationToHoursAndMinutes

func DurationToHoursAndMinutes(duration time.Duration) string

DurationToHoursAndMinutes converts a duration in milliseconds to a formatted string representing hours and minutes.

func FormatDate

func FormatDate(date time.Time, timeZone string) string

FormatDate formats a time.Time value to a string using a specific date and time layout string and the specified time zone.

func GetDirSize

func GetDirSize(path string) (float64, error)

func GetDurationTillTime

func GetDurationTillTime(start time.Time, duration time.Duration) (time.Duration, error)

GetDurationTillTime calculates the duration between a specified start time and the current time and returns it as a time.Duration value.

func GetVolumeSize

func GetVolumeSize(volumeName string) (float64, error)

func ParseEpochTime

func ParseEpochTime(epoch string) (*time.Time, error)

ParseEpochTime parses a string representing an epoch time and returns a pointer to a time.Time value.

func ParseIntFromString

func ParseIntFromString(str string) (int, error)

ParseIntFromString extracts the integer part from a string that may have a suffix. The suffix can be any non-digit characters at the end of the string. If the string cannot be parsed, an error is returned.

func StringMsToDuration

func StringMsToDuration(durationString string) (time.Duration, error)

StringMsToDuration converts a string representing a duration in milliseconds to a time.Duration value.

Types

type NetworkUsage

type NetworkUsage struct {
	Recv float64
	Sent float64
}

func GetNetworkUsage

func GetNetworkUsage() (*NetworkUsage, error)

type UsageData

type UsageData struct {
	Total          int
	Free           int
	Used           int
	PercentageUsed int
}

func GetCPUUsage

func GetCPUUsage() (*UsageData, error)

func GetDiskUsage

func GetDiskUsage() (*UsageData, error)

func GetMemoryUsage

func GetMemoryUsage() (*UsageData, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL