MCPcopy
hub / github.com/tinode/chat / getCreatedTime

Function getCreatedTime

tinode-db/gendb.go:414–421  ·  view source on GitHub ↗

Go json cannot unmarshal Duration from a string, thus this hack.

(delta string)

Source from the content-addressed store, hash-verified

412
413// Go json cannot unmarshal Duration from a string, thus this hack.
414func getCreatedTime(delta string) time.Time {
415 dd, err := time.ParseDuration(delta)
416 if err != nil && delta != "" {
417 log.Fatal("Invalid duration string", delta)
418 }
419
420 return time.Now().UTC().Round(time.Millisecond).Add(dd)
421}
422
423type photoStruct struct {
424 Type string `json:"type" db:"type"`

Callers 1

genDbFunction · 0.85

Calls 1

AddMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…