1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-30 05:56:54 -05:00

Remove call to UTC() which is not necessary.

This commit is contained in:
V2Ray 2015-10-29 12:04:14 +01:00
parent d0ae47e2ce
commit fdb41bbd50
4 changed files with 7 additions and 7 deletions

View File

@ -72,7 +72,7 @@ func (queue *TimedQueue) RemovedEntries() <-chan interface{} {
func (queue *TimedQueue) cleanup(tick <-chan time.Time) {
for now := range tick {
nowSec := now.UTC().Unix()
nowSec := now.Unix()
for {
queue.access.RLock()
queueLen := queue.queue.Len()

View File

@ -12,7 +12,7 @@ func TestTimedQueue(t *testing.T) {
removed := make(map[string]bool)
nowSec := time.Now().UTC().Unix()
nowSec := time.Now().Unix()
q := NewTimedQueue(2)
go func() {
@ -51,7 +51,7 @@ func TestTimedQueue(t *testing.T) {
<-tick
assert.Bool(removed["Values"]).IsFalse()
q.Add("Value1", time.Now().UTC().Unix()+10)
q.Add("Value1", time.Now().Unix()+10)
<-tick
v1, ok = removed["Value1"]

View File

@ -63,10 +63,10 @@ func (us *TimedUserSet) generateNewHashes(lastSec, nowSec int64, idx int, id *co
}
func (us *TimedUserSet) updateUserHash(tick <-chan time.Time) {
lastSec := time.Now().UTC().Unix() - cacheDurationSec
lastSec := time.Now().Unix() - cacheDurationSec
for now := range tick {
nowSec := now.UTC().Unix() + cacheDurationSec
nowSec := now.Unix() + cacheDurationSec
for idx, id := range us.validUserIds {
us.generateNewHashes(lastSec, nowSec, idx, id)
}
@ -79,7 +79,7 @@ func (us *TimedUserSet) AddUser(user config.User) error {
idx := len(us.validUserIds)
us.validUserIds = append(us.validUserIds, id)
nowSec := time.Now().UTC().Unix()
nowSec := time.Now().Unix()
lastSec := nowSec - cacheDurationSec
us.generateNewHashes(lastSec, nowSec+cacheDurationSec, idx, id)

View File

@ -166,7 +166,7 @@ func (request *VMessRequest) ToBytes(idHash user.CounterHash, randomRangeInt64 u
buffer = alloc.NewSmallBuffer().Clear()
}
counter := randomRangeInt64(time.Now().UTC().Unix(), 30)
counter := randomRangeInt64(time.Now().Unix(), 30)
hash := idHash.Hash(request.UserId.Bytes[:], counter)
buffer.Append(hash)