Talk:Averages/Mean time of day: Difference between revisions

→‎TCL and rounding: Things are very strange, but I'm not sure that they're wrong yet
(→‎TCL and rounding: Things are very strange, but I'm not sure that they're wrong yet)
Line 22:
return '%02i:%02i:%02i' % (h, m, s)</lang>
--[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 05:57, 2 July 2013 (UTC)
 
I'm not convinced that the averaging used is wrong. For example, when I try an alternative mechanism for time averaging (with times being either “pre” or “post” midnight so as to minimise the deltas):
<lang tcl>% set t [clock scan 23:00:17 -base 0]
79217
% incr t [clock scan 23:40:20 -base 0]
160837
% incr t [clock add [clock scan 00:12:45 -base 0] 1 day]
244402
% incr t [clock add [clock scan 00:17:19 -base 0] 1 day]
328241
% expr $t/4
82060
% clock format [expr $t/4] -format %H:%M:%S
23:47:40</lang>
As you can see, I get a different answer (several seconds out) and that's using exact arithmetic. (You might get different intermediate values — they're local-timezone-dependant without the <tt>-gmt true</tt> option — but the final formatted result should be the same.) –[[User:Dkf|Donal Fellows]] ([[User talk:Dkf|talk]]) 12:59, 28 August 2013 (UTC)
Anonymous user