1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-06-25 22:08:03 +02:00

Add visitor_seen to the log context

This commit is contained in:
binwiederhier 2023-03-03 13:56:48 -05:00
parent 166dc6b4fa
commit 1ce92714c4
3 changed files with 17 additions and 7 deletions

View file

@ -14,6 +14,15 @@ var (
durationStrRegex = regexp.MustCompile(`(?i)^(\d+)\s*(d|days?|h|hours?|m|mins?|minutes?|s|secs?|seconds?)$`)
)
const (
timestampFormat = "2006-01-02T15:04:05.999Z07:00" // Like RFC3339, but with milliseconds
)
// FormatTime formats a time.Time in a RFC339-like format that includes milliseconds
func FormatTime(t time.Time) string {
return t.Format(timestampFormat)
}
// NextOccurrenceUTC takes a time of day (e.g. 9:00am), and returns the next occurrence
// of that time from the current time (in UTC).
func NextOccurrenceUTC(timeOfDay, base time.Time) time.Time {