package clockface import ( "math" "time" ) type Point struct { X float64 Y float64 } func secondsInRadians(t time.Time) float64 { return math.Pi / (30 / (float64(t.Second()))) } func minutesInRadians(t time.Time) float64 { return secondsInRadians(t)/60 + math.Pi/(30/(float64(t.Minute()))) } func angleToPoint(angle float64) Point { x := math.Sin(angle) y := math.Cos(angle) return Point{x, y} } func secondHandPoint(t time.Time) Point { return angleToPoint(secondsInRadians(t)) } func minuteHandPoint(t time.Time) Point { return angleToPoint(minutesInRadians(t)) }