timezone

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2025 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package timezone provides timezone candidate evaluation and analysis.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectPeakProductivityWithHalfHours

func DetectPeakProductivityWithHalfHours(halfHourCounts map[float64]int, _ int) (start, end float64, count int)

DetectPeakProductivityWithHalfHours identifies the single 30-minute bucket with highest activity.

Types

type Candidate

type Candidate struct {
	Timezone            string   `json:"timezone"`
	ScoringDetails      []string `json:"scoring_details"`
	LunchStartUTC       float64  `json:"lunch_start_utc"`
	Confidence          float64  `json:"confidence"`
	Offset              float64  `json:"offset"`
	LunchConfidence     float64  `json:"lunch_confidence"`
	LunchEndUTC         float64  `json:"lunch_end_utc"`
	EveningActivity     int      `json:"evening_activity"`
	LunchLocalTime      float64  `json:"lunch_local_time"`
	WorkStartLocal      float64  `json:"work_start_local"`
	SleepMidLocal       float64  `json:"sleep_mid_local"`
	LunchDipStrength    float64  `json:"lunch_dip_strength"`
	PeakTimeReasonable  bool     `json:"peak_time_reasonable"`
	SleepReasonable     bool     `json:"sleep_reasonable"`
	WorkHoursReasonable bool     `json:"work_hours_reasonable"`
	LunchReasonable     bool     `json:"lunch_reasonable"`
	IsProfile           bool     `json:"is_profile"` // True if this matches the user's profile timezone
}

Candidate represents a timezone detection result with evidence.

func EvaluateCandidates

func EvaluateCandidates(username string, hourCounts map[int]int, halfHourCounts map[float64]int, totalActivity int, quietHours []int, midQuiet float64, activeStart float64, bestGlobalLunch GlobalLunchPattern, profileTimezone string, newestActivity time.Time) []Candidate

type GlobalLunchPattern

type GlobalLunchPattern struct {
	StartUTC    float64
	EndUTC      float64
	Confidence  float64
	DropPercent float64
}

GlobalLunchPattern represents the best lunch pattern found globally in UTC.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL