Exemplo n.º 1
0
func ExampleStopWatch() {
	var s util.StopWatch
	s.Start()
	time.Sleep(time.Duration(1 * time.Second))
	s.Stop()
	d := s.GetElapsed()
	fmt.Printf("%d\n", util.Lrint(d.Seconds()))
	s.Reset()
	d = s.GetElapsed()
	fmt.Printf("%d\n", util.Lrint(d.Seconds()))
	// Output: 1
	// 0
}
Exemplo n.º 2
0
func ExampleLrint() {
	fmt.Println(util.Lrint(5.01))
	fmt.Println(util.Lrint(4.99))
	fmt.Println(util.Lrint(4.50))
	fmt.Println(util.Lrint(5.50))
	fmt.Println(util.Lrint(5.499999999999999))
	fmt.Println(util.Lrint(5.4999999999999999))
	fmt.Println(util.Lrint(-1.4))
	// Output: 5
	// 5
	// 5
	// 6
	// 5
	// 6
	// -1
}