forked from ByteArena/box2d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommonB2Timer.go
31 lines (25 loc) · 899 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 Timer struct {
m_start time.Time
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// B2Timer.cpp
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
func MakeTimer() Timer {
timer := Timer{}
timer.Reset()
return timer
}
func (timer *Timer) Reset() {
timer.m_start = time.Now()
}
func (timer Timer) GetMilliseconds() float64 {
return time.Since(timer.m_start).Seconds() * 1000
}