Beispiel #1
0
func (c *ClockConv) init(n int) {
	c.cpu_s = int64(C.__getNow())
	c.sys_s = time.Now().UnixNano()
	for i := 0; i < n; i++ {
		c.update()
		time.Sleep(time.Millisecond * 1)
	}
	c.calc()
}
Beispiel #2
0
func (c *ClockConv) recalc() {
	cpu_n := int64(C.__getNow())
	sys_n := time.Now().UnixNano()
	//fmt.Println("re calc", sys_n-c.sys_s)
	c.a = float64(sys_n-c.sys_s) / float64(cpu_n-c.cpu_s)
	c.s = 0.
	c.xs[0], c.xs[1] = 0., 0.
	c.off = cpu_n
	c.start = sys_n
	c.cpu_s = cpu_n
	c.sys_s = sys_n
}
Beispiel #3
0
func (c *ClockConv) getNow() int64 {
	n := C.__getNow()
	return int64(n) - c.off
}