shogi-server source
Révision | 3d228b20abc8b692cc42cc3d5c57686269de2279 (tree) |
---|---|
l'heure | 2015-11-27 23:40:28 |
Auteur | Daigo Moriwaki <daigo@debi...> |
Commiter | Daigo Moriwaki |
Fix #35795: A time consumed could be -1
* [shogi-server] shogi_server/time_clock.rb:
@@ -1,3 +1,16 @@ | ||
1 | +2015-11-27 Daigo Moriwaki <daigo at debian dot org> | |
2 | + | |
3 | + * [shogi-server] shogi_server/time_clock.rb: | |
4 | + - A time consumed could be -1. | |
5 | + * The start time of a move is captured after sending a move to a | |
6 | + player of the next turn at the end of the giant lock | |
7 | + * The end time of the move is captured at the exact time when the | |
8 | + server receives it before the giant lock | |
9 | + Therefore, end_time < start_time is possible when a player returns a | |
10 | + move instantly. | |
11 | + Thanks to Tomoyuki Kaneko for reporting this issue. | |
12 | + (Closes: #35795) | |
13 | + | |
1 | 14 | 2015-02-14 Daigo Moriwaki <daigo at debian dot org> |
2 | 15 | |
3 | 16 | * util/statistics.rb: |
@@ -125,11 +125,6 @@ class ChessClockWithLeastZero < ChessClock | ||
125 | 125 | super |
126 | 126 | end |
127 | 127 | |
128 | - def time_duration(mytime, start_time, end_time) | |
129 | - t = end_time - start_time | |
130 | - return t.floor | |
131 | - end | |
132 | - | |
133 | 128 | def to_s |
134 | 129 | return "ChessClockWithLeastZero: LeastTimePerMove %d; TotalTime %d; Byoyomi %d" % [@least_time_per_move, @total_time, @byoyomi] |
135 | 130 | end |
@@ -79,6 +79,8 @@ class TestChessClockWithLeastZero < Test::Unit::TestCase | ||
79 | 79 | assert_equal(1, tc.time_duration(1, 100, 101)) # 1 |
80 | 80 | assert_equal(2, tc.time_duration(100, 100.1, 102.9)) # 2.8 |
81 | 81 | assert_equal(2, tc.time_duration(100, 100, 102)) # 2 |
82 | + | |
83 | + assert_equal(0, tc.time_duration(100, 100, 99.9)) # -0.1 | |
82 | 84 | end |
83 | 85 | |
84 | 86 | def test_time_duration_over_thinking_time |