Timezone detection from activity patterns. Analyzes timestamped events to identify likely UTC offsets based on sleep patterns, lunch breaks, work hours, and evening activity.
go get github.com/codeGROOVE-dev/ditzy
From timestamped events:
events := []ditzy.Event{
{Time: time.Parse(time.RFC3339, "2024-01-15T14:30:00Z"), Type: "commit"},
{Time: time.Parse(time.RFC3339, "2024-01-15T15:45:00Z"), Type: "push"},
}
result := ditzy.FromEvents(events)
fmt.Printf("Timezone: %s (confidence: %.1f)\n",
result.Candidates[0].Timezone,
result.Candidates[0].Confidence)From pre-aggregated half-hour buckets:
buckets := map[float64]int{
14.0: 5, // 2:00-2:29 PM UTC
14.5: 8, // 2:30-2:59 PM UTC
15.0: 12, // 3:00-3:29 PM UTC
}
result := ditzy.FromBuckets(buckets,
ditzy.WithClaimedTimezone("America/New_York"))- Sleep patterns: Identifies quiet periods (21:00-09:00 local) as sleep indicators
- Lunch breaks: Detects activity dips between 11:00-14:30 local time
- Work hours: Validates reasonable work start times (6:00-11:00 local)
- Evening activity: Uses 19:00-23:00 local activity as a strong timezone signal
- Peak productivity: Scores based on when maximum activity occurs
Results include confidence scores and detailed analysis data for each candidate timezone.