1
0
mirror of https://github.com/google/uuid.git synced 2024-11-28 08:49:08 +02:00

Remove underscores form private variables.

This commit is contained in:
Paul Borman 2016-02-29 06:07:51 -08:00
parent 834b00a6a5
commit 33471c92ef
2 changed files with 18 additions and 18 deletions

18
time.go
View File

@ -25,7 +25,7 @@ const (
var (
timeMu sync.Mutex
lasttime uint64 // last time we returned
clock_seq uint16 // clock sequence for this run
clockSeq uint16 // clock sequence for this run
timeNow = time.Now // for testing
)
@ -52,7 +52,7 @@ func getTime() (Time, uint16, error) {
t := timeNow()
// If we don't have a clock sequence already, set one.
if clock_seq == 0 {
if clockSeq == 0 {
setClockSequence(-1)
}
now := uint64(t.UnixNano()/100) + g1582ns100
@ -60,10 +60,10 @@ func getTime() (Time, uint16, error) {
// If time has gone backwards with this clock sequence then we
// increment the clock sequence
if now <= lasttime {
clock_seq = ((clock_seq + 1) & 0x3fff) | 0x8000
clockSeq = ((clockSeq + 1) & 0x3fff) | 0x8000
}
lasttime = now
return Time(now), clock_seq, nil
return Time(now), clockSeq, nil
}
// ClockSequence returns the current clock sequence, generating one if not
@ -80,10 +80,10 @@ func ClockSequence() int {
}
func clockSequence() int {
if clock_seq == 0 {
if clockSeq == 0 {
setClockSequence(-1)
}
return int(clock_seq & 0x3fff)
return int(clockSeq & 0x3fff)
}
// SetClockSeq sets the clock sequence to the lower 14 bits of seq. Setting to
@ -100,9 +100,9 @@ func setClockSequence(seq int) {
randomBits(b[:]) // clock sequence
seq = int(b[0])<<8 | int(b[1])
}
old_seq := clock_seq
clock_seq = uint16(seq&0x3fff) | 0x8000 // Set our variant
if old_seq != clock_seq {
old_seq := clockSeq
clockSeq = uint16(seq&0x3fff) | 0x8000 // Set our variant
if old_seq != clockSeq {
lasttime = 0
}
}

View File

@ -29,14 +29,14 @@ func NewUUID() (UUID, error) {
return uuid, err
}
time_low := uint32(now & 0xffffffff)
time_mid := uint16((now >> 32) & 0xffff)
time_hi := uint16((now >> 48) & 0x0fff)
time_hi |= 0x1000 // Version 1
timeLow := uint32(now & 0xffffffff)
timeMid := uint16((now >> 32) & 0xffff)
timeHi := uint16((now >> 48) & 0x0fff)
timeHi |= 0x1000 // Version 1
binary.BigEndian.PutUint32(uuid[0:], time_low)
binary.BigEndian.PutUint16(uuid[4:], time_mid)
binary.BigEndian.PutUint16(uuid[6:], time_hi)
binary.BigEndian.PutUint32(uuid[0:], timeLow)
binary.BigEndian.PutUint16(uuid[4:], timeMid)
binary.BigEndian.PutUint16(uuid[6:], timeHi)
binary.BigEndian.PutUint16(uuid[8:], seq)
copy(uuid[10:], nodeID[:])