MCPcopy Index your code
hub / github.com/coder/coder / truncateMidnight

Function truncateMidnight

coderd/schedule/autostop.go:279–282  ·  view source on GitHub ↗

truncateMidnight truncates a time to midnight in the time object's timezone. t.Truncate(24 * time.Hour) truncates based on the internal time and doesn't factor daylight savings properly. See: https://github.com/golang/go/issues/10894

(t time.Time)

Source from the content-addressed store, hash-verified

277//
278// See: https://github.com/golang/go/issues/10894
279func truncateMidnight(t time.Time) time.Time {
280 yy, mm, dd := t.Date()
281 return time.Date(yy, mm, dd, 0, 0, 0, 0, t.Location())
282}
283
284// nextDayMidnight returns the next midnight in the time object's timezone.
285func nextDayMidnight(t time.Time) time.Time {

Callers 1

CalculateAutostopFunction · 0.85

Calls 1

LocationMethod · 0.80

Tested by

no test coverage detected