fixed a bug where the field name was not capitalized hence not public, also deleted unnecessary getter
This commit is contained in:
1 parent
be44d008c7
commit
88b5ff98cd
3 files changed
+4
-8
No files matched your search
@@ -37,7 +37,7 @@ func getLinuxUptime() (UptimeInformation, error) {
|
|||||||
busyTime, _ = strconv.ParseFloat(fields[0], 64)
|
busyTime, _ = strconv.ParseFloat(fields[0], 64)
|
||||||
|
|
||||||
return UptimeInformation{
|
return UptimeInformation{
|
||||||
uptime: busyTime,
|
Uptime: busyTime,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,15 +6,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type UptimeInformation struct {
|
type UptimeInformation struct {
|
||||||
uptime float64
|
Uptime float64
|
||||||
}
|
|
||||||
|
|
||||||
func (uptimeInfo UptimeInformation) GetUptime() (seconds float64) {
|
|
||||||
return uptimeInfo.uptime
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (uptimeInfo UptimeInformation) FormatSeconds() string {
|
func (uptimeInfo UptimeInformation) FormatSeconds() string {
|
||||||
total := int64(math.Round(uptimeInfo.uptime))
|
total := int64(math.Round(uptimeInfo.Uptime))
|
||||||
|
|
||||||
if total < 60 {
|
if total < 60 {
|
||||||
return fmt.Sprintf("%d", total)
|
return fmt.Sprintf("%d", total)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ func getWinUptime(uptime *windows.LazyProc) (UptimeInformation, error) {
|
|||||||
|
|
||||||
uptimeSeconds := float64(uptimeMetric) / 1000.0
|
uptimeSeconds := float64(uptimeMetric) / 1000.0
|
||||||
|
|
||||||
return UptimeInformation{uptime: uptimeSeconds}, nil
|
return UptimeInformation{Uptime: uptimeSeconds}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetUptimeInformation() (UptimeInformation, error) {
|
func GetUptimeInformation() (UptimeInformation, error) {
|
||||||
|
|||||||
Reference in new issue
Block a user