// Package clock provides the single source of truth for time across the
// application. All wall-clock operations use Now() for UTC consistency with
// the database. LondonLocation provides Europe/London for cron schedules and
// scheduling calculations that depend on local business-closing rules.
package clock

import "time"

// Now returns the current UTC time, used everywhere for wall-clock consistency.
// All scheduling comparisons, timestamp recording, and duration calculations use
// this function so they're consistent with the database (TIMESTAMPTZ in UTC).
func Now() time.Time {
	return time.Now().UTC()
}

// London is the Europe/London timezone location, used for cron schedules and
// business-closing calculations.
var London = func() *time.Location {
	loc, err := time.LoadLocation("Europe/London")
	if err != nil {
		panic("clock: failed to load Europe/London timezone: " + err.Error())
	}
	return loc
}()
