This repository has been archived on 2024-05-11. You can view files and clone it, but cannot push or open issues or pull requests.
Corn-Utility/toolbox/system.go

20 lines
355 B
Go
Raw Normal View History

2023-10-19 18:08:38 -04:00
package toolbox
2023-10-24 19:54:13 -04:00
import "time"
2023-10-19 18:08:38 -04:00
2023-10-20 01:18:13 -04:00
/*
System/OS-related utilities such as uptime.
*/
2023-10-19 18:08:38 -04:00
var timerStart = time.Now()
2023-10-20 01:18:13 -04:00
/*
Nor the Go or the Disgo library has a built-in
Client/Process uptime function, so I had to get creative.
*/
2023-10-19 18:08:38 -04:00
func GetUptime() string {
uptime := time.Since(timerStart)
2023-10-23 03:36:40 -04:00
roundedUp := uptime.Round(time.Second)
return roundedUp.String()
2023-10-19 18:08:38 -04:00
}