move currentMs() to kcp.go

This commit is contained in:
xtaci
2019-06-01 18:23:55 +08:00
parent f461a5b74d
commit cf683954a2
2 changed files with 7 additions and 6 deletions
+7
View File
@@ -3,6 +3,7 @@ package kcp
import (
"encoding/binary"
"sync/atomic"
"time"
)
const (
@@ -29,6 +30,12 @@ const (
IKCP_PROBE_LIMIT = 120000 // up to 120 secs to probe window
)
// monotonic reference time point
var refTime time.Time = time.Now()
// currentMs returns current elasped monotonic milliseconds since program startup
func currentMs() uint32 { return uint32(time.Now().Sub(refTime) / time.Millisecond) }
// output_callback is a prototype which ought capture conn and call conn.Write
type output_callback func(buf []byte, size int)
-6
View File
@@ -984,9 +984,3 @@ func NewConn(raddr string, block BlockCrypt, dataShards, parityShards int, conn
}
return NewConn2(udpaddr, block, dataShards, parityShards, conn)
}
// monotonic reference time point
var refTime time.Time = time.Now()
// currentMs returns current elasped monotonic milliseconds since program startup
func currentMs() uint32 { return uint32(time.Now().Sub(refTime) / time.Millisecond) }