MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / getDatePrecisionFromTime

Function getDatePrecisionFromTime

internal/filter/datetime.go:73–93  ·  view source on GitHub ↗
(t time.Time)

Source from the content-addressed store, hash-verified

71}
72
73func getDatePrecisionFromTime(t time.Time) string {
74 if t.Nanosecond()%1000000 != 0 && t.Nanosecond()%1000 != 0 {
75 return "microseconds"
76 }
77 if t.Nanosecond()%1000000 != 0 {
78 return "microseconds"
79 }
80 if t.Nanosecond() != 0 {
81 return "milliseconds"
82 }
83 if t.Second() != 0 {
84 return "second"
85 }
86 if t.Minute() != 0 {
87 return "minute"
88 }
89 if t.Hour() != 0 {
90 return "hour"
91 }
92 return "day"
93}
94
95func computeTimestampRange(ts TimestampValue) (floor time.Time, ceiling time.Time) {
96 t := ts.Time

Callers 2

buildStandardConditionFunction · 0.85
buildJSONPathConditionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected