forked from ByteArena/box2d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CommonB2Timer.go
31 lines (25 loc) · 917 Bytes
/
CommonB2Timer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package box2d
import "time"
/// Timer for profiling. This has platform specific code and may
/// not work on every platform.
type B2Timer struct {
m_start time.Time
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// B2Timer.cpp
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
func MakeB2Timer() B2Timer {
timer := B2Timer{}
timer.Reset()
return timer
}
func (timer *B2Timer) Reset() {
timer.m_start = time.Now()
}
func (timer B2Timer) GetMilliseconds() float64 {
return time.Now().Sub(timer.m_start).Seconds() * 1000
}