mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
rename all timestamp function names from *Second to Timestamp*
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -27,7 +27,7 @@ func main() {
|
||||
},
|
||||
MemUsed: 15560320,
|
||||
MemTotal: 16333788,
|
||||
Time: int(gtime.Second()),
|
||||
Time: int(gtime.Timestamp()),
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user