Averages/Mean time of day: Difference between revisions

m (→‎{{header|C#}}: Changing the section header so that task shows up under the language properly)
Line 11:
 
=={{header|AutoHotkey}}==
{{works with|AutoHotkey_L}}(AutoHotkey1AutoHotkey 1.1+)}}
<lang AutoHotkey>MsgBox, % "The mean time is: " MeanTime(["23:00:17", "23:40:20", "00:12:45", "00:17:19"])
 
MeanTime(t, x=0, y=0) {
static c := ATan(1) / 45
for k, v in t {
n := StrSplit(v, ":")
, r := c * (n[1] * 3600 + n[2] * 60 + n[3]) / 240
, x += Cos(r)
, y += Sin(r)
}
r := atan2(x, y) / c
r := (r < 0 ? r + 360 : r) / 15
Line 31 ⟶ 32:
atan2(x, y) {
return dllcall("msvcrt\atan2", "Double",y, "Double",x, "CDECL Double")
}</lang>
}</lang>atan2() is available [http://www.autohotkey.com/board/topic/24114-popup-calculator-expression-evaluator/ here].
{{out}}
<pre>The mean time is: 23:47:43</pre>
266

edits