rename all timestamp function names from *Second to Timestamp*

This commit is contained in:
John
2020-01-20 14:14:11 +08:00
parent 8021f39710
commit 7df53ff55e
23 changed files with 72 additions and 72 deletions

View File

@ -100,53 +100,53 @@ func testConvert() {
func testSplitChar() {
var v interface{}
j := gjson.New(nil)
t1 := gtime.Nanosecond()
t1 := gtime.TimestampNano()
j.Set("a.b.c.d.e.f.g.h.i.j.k", 1)
t2 := gtime.Nanosecond()
t2 := gtime.TimestampNano()
fmt.Println(t2 - t1)
t5 := gtime.Nanosecond()
t5 := gtime.TimestampNano()
v = j.Get("a.b.c.d.e.f.g.h.i.j.k")
t6 := gtime.Nanosecond()
t6 := gtime.TimestampNano()
fmt.Println(v)
fmt.Println(t6 - t5)
j.SetSplitChar('#')
t7 := gtime.Nanosecond()
t7 := gtime.TimestampNano()
v = j.Get("a#b#c#d#e#f#g#h#i#j#k")
t8 := gtime.Nanosecond()
t8 := gtime.TimestampNano()
fmt.Println(v)
fmt.Println(t8 - t7)
}
func testViolenceCheck() {
j := gjson.New(nil)
t1 := gtime.Nanosecond()
t1 := gtime.TimestampNano()
j.Set("a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a", 1)
t2 := gtime.Nanosecond()
t2 := gtime.TimestampNano()
fmt.Println(t2 - t1)
t3 := gtime.Nanosecond()
t3 := gtime.TimestampNano()
j.Set("a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a", 1)
t4 := gtime.Nanosecond()
t4 := gtime.TimestampNano()
fmt.Println(t4 - t3)
t5 := gtime.Nanosecond()
t5 := gtime.TimestampNano()
j.Get("a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a")
t6 := gtime.Nanosecond()
t6 := gtime.TimestampNano()
fmt.Println(t6 - t5)
j.SetViolenceCheck(false)
t7 := gtime.Nanosecond()
t7 := gtime.TimestampNano()
j.Set("a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a", 1)
t8 := gtime.Nanosecond()
t8 := gtime.TimestampNano()
fmt.Println(t8 - t7)
t9 := gtime.Nanosecond()
t9 := gtime.TimestampNano()
j.Get("a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a")
t10 := gtime.Nanosecond()
t10 := gtime.TimestampNano()
fmt.Println(t10 - t9)
}

View File

@ -10,7 +10,7 @@ func main() {
s := g.Server()
s.Group("/", func(group *ghttp.RouterGroup) {
g.GET("/set", func(r *ghttp.Request) {
r.Session.Set("time", gtime.Second())
r.Session.Set("time", gtime.Timestamp())
r.Response.Write("ok")
})
g.GET("/get", func(r *ghttp.Request) {

View File

@ -27,7 +27,7 @@ func main() {
},
MemUsed: 15560320,
MemTotal: 16333788,
Time: int(gtime.Second()),
Time: int(gtime.Timestamp()),
})
if err != nil {
panic(err)

View File

@ -9,7 +9,7 @@ import (
)
func main() {
start := gtime.Millisecond()
start := gtime.TimestampMilli()
wg := sync.WaitGroup{}
for i := 0; i < 100000; i++ {
wg.Add(1)
@ -19,5 +19,5 @@ func main() {
}()
}
wg.Wait()
fmt.Println("time spent:", gtime.Millisecond()-start)
fmt.Println("time spent:", gtime.TimestampMilli()-start)
}

View File

@ -10,7 +10,7 @@ import (
)
func main() {
start := gtime.Millisecond()
start := gtime.TimestampMilli()
wg := sync.WaitGroup{}
for i := 0; i < 100000; i++ {
wg.Add(1)
@ -21,5 +21,5 @@ func main() {
}
wg.Wait()
fmt.Println(grpool.Size())
fmt.Println("time spent:", gtime.Millisecond()-start)
fmt.Println("time spent:", gtime.TimestampMilli()-start)
}

View File

@ -9,8 +9,8 @@ import (
func main() {
fmt.Println("Date :", gtime.Date())
fmt.Println("Datetime :", gtime.Datetime())
fmt.Println("Second :", gtime.Second())
fmt.Println("Millisecond:", gtime.Millisecond())
fmt.Println("Microsecond:", gtime.Microsecond())
fmt.Println("Nanosecond :", gtime.Nanosecond())
fmt.Println("Second :", gtime.Timestamp())
fmt.Println("Millisecond:", gtime.TimestampMilli())
fmt.Println("Microsecond:", gtime.TimestampMicro())
fmt.Println("Nanosecond :", gtime.TimestampNano())
}