Пример #1
0
func main() {
	flag.Parse()

	uptimes, err := w32uptime.ReadAll()
	if err != nil {
		log.Fatal(err)
	}

	if len(uptimes) == 0 {
		log.Fatal("no events found")
	}
	if _limit > 0 {
		n := len(uptimes) - _limit
		if n > 0 {
			uptimes = uptimes[n:]
		}
	}

	if _file != "" {
		fd, err := os.OpenFile(_file, os.O_WRONLY|os.O_CREATE, 0600)
		if err != nil {
			log.Fatal(err)
		}
		defer fd.Close()

		err = writeToFile(fd, uptimes)
	} else {
		err = writeToFile(os.Stdout, uptimes)
	}

	if err != nil {
		log.Fatal(err)
	}
}
Пример #2
0
func main() {
	var err error
	uptimes, err = w32uptime.ReadAll()
	if err != nil {
		println(err.Error())
		return
	}

	go startGui()
	wde.Run()
}