forked from jirs5/gosigar-freebsd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for undefined type syscall.Timeval32 Usec and Sec methods on darw…
…in/386 (#128) Fixes darwin/386 where syscall.Timeval32 Usec and Sec methods were undefined. Fixes #127
- Loading branch information
1 parent
cd07243
commit 356ba2b
Showing
3 changed files
with
36 additions
and
12 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package gosigar | ||
|
||
import ( | ||
"syscall" | ||
"time" | ||
) | ||
|
||
func (self *Uptime) Get() error { | ||
tv := syscall.Timeval{} | ||
|
||
if err := sysctlbyname("kern.boottime", &tv); err != nil { | ||
return err | ||
} | ||
|
||
self.Length = time.Since(time.Unix(int64(tv.Sec), int64(tv.Usec)*1000)).Seconds() | ||
|
||
return nil | ||
} |
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,18 @@ | ||
package gosigar | ||
|
||
import ( | ||
"syscall" | ||
"time" | ||
) | ||
|
||
func (self *Uptime) Get() error { | ||
tv := syscall.Timeval32{} | ||
|
||
if err := sysctlbyname("kern.boottime", &tv); err != nil { | ||
return err | ||
} | ||
|
||
self.Length = time.Since(time.Unix(int64(tv.Sec), int64(tv.Usec)*1000)).Seconds() | ||
|
||
return nil | ||
} |