+2015-11-27 Daigo Moriwaki <daigo at debian dot org>
+
+ * [shogi-server] shogi_server/time_clock.rb:
+ - A time consumed could be -1.
+ * The start time of a move is captured after sending a move to a
+ player of the next turn at the end of the giant lock
+ * The end time of the move is captured at the exact time when the
+ server receives it before the giant lock
+ Therefore, end_time < start_time is possible when a player returns a
+ move instantly.
+ Thanks to Tomoyuki Kaneko for reporting this issue.
+ (Closes: #35795)
+
2015-02-14 Daigo Moriwaki <daigo at debian dot org>
* util/statistics.rb:
super
end
- def time_duration(mytime, start_time, end_time)
- t = end_time - start_time
- return t.floor
- end
-
def to_s
return "ChessClockWithLeastZero: LeastTimePerMove %d; TotalTime %d; Byoyomi %d" % [@least_time_per_move, @total_time, @byoyomi]
end
assert_equal(1, tc.time_duration(1, 100, 101)) # 1
assert_equal(2, tc.time_duration(100, 100.1, 102.9)) # 2.8
assert_equal(2, tc.time_duration(100, 100, 102)) # 2
+
+ assert_equal(0, tc.time_duration(100, 100, 99.9)) # -0.1
end
def test_time_duration_over_thinking_time