MCPcopy Index your code
hub / github.com/apache/devlake / NilIfZeroTime

Function NilIfZeroTime

backend/core/utils/time.go:24–32  ·  view source on GitHub ↗

NilIfZeroTime returns nil if t is nil or represents the zero time (0001-01-01...). Otherwise, it returns t unchanged.

(t *time.Time)

Source from the content-addressed store, hash-verified

22// NilIfZeroTime returns nil if t is nil or represents the zero time (0001-01-01...).
23// Otherwise, it returns t unchanged.
24func NilIfZeroTime(t *time.Time) *time.Time {
25 if t == nil {
26 return nil
27 }
28 if t.IsZero() {
29 return nil
30 }
31 return t
32}

Callers 1

TestNilIfZeroTimeFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestNilIfZeroTimeFunction · 0.68