simplereach / timeutils

A Go Wrapper for Approxidate
41 stars 4 forks source link

Parsing dont work right, time hopping... #5

Open Dexus opened 7 years ago

Dexus commented 7 years ago
ts := timeutils.NewTime(time.Now(), timeutils.TimestampNano)
tts, _ := timeutils.ParseDateString(ts.UTC().String())
tts.String()

the tts.String() Time hopping always around, we have now 11:54 but the output hopping to 12:07, 11:50 etc.

EDIT: Info to system: Alpine Linux (Linux 4.5.7-std-3 x86_64 ); go version go1.8.1 linux/amd64

Dexus commented 7 years ago

Okay my fault, is a problem of the used parser approxidate...

the microtime is to long for correct parsing with approxidate

edit: microtime = nanotime

elubow commented 7 years ago

The issue with trying to parse millis and nanos is that you don't know if it is millis or nanos without it being explicitly stated. Hence the reason we chose millis because it more suited the purpose at the time. Are you asking if I can add a ParseNano function?

Dexus commented 7 years ago

Yes, maybe it would nice to have the function. Because i use this in JSON and get only hopping dates. We have over 40k req/s so we need the exact time for problem reports.

And cause of the given TimestampNano i thought it will also parse it correct.