chromedp / cdproto

Package cdproto contains the generated commands, types, and events for the Chrome DevTools Protocol domains.
MIT License
149 stars 54 forks source link

fix TimeSinceEpoch UnmarshalEasyJSON #26

Closed rickywei closed 1 year ago

rickywei commented 1 year ago

It seems that the time should multiply time.Millisecond (1e6) rather than time.Second (1e9)

package main

import (
    "fmt"
    "time"
)

func main() {
    // a response time from cdp log
    t := 1.685446691349539e+12

    // correct time 2023-05-30 19:38:11.349539072 +0800 CST
    fmt.Println(time.Unix(0, int64(t*float64(time.Millisecond))))

    // wrong time 1677-09-21 08:12:43.145224192 +0800 CST
    fmt.Println(time.Unix(0, int64(t*float64(time.Second))))
}
rickywei commented 1 year ago

move to cdproto-gen