• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

shogi-server source


Commit MetaInfo

Révision3d228b20abc8b692cc42cc3d5c57686269de2279 (tree)
l'heure2015-11-27 23:40:28
AuteurDaigo Moriwaki <daigo@debi...>
CommiterDaigo Moriwaki

Message de Log

Fix #35795: A time consumed could be -1

* [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)

Change Summary

Modification

--- a/changelog
+++ b/changelog
@@ -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+
114 2015-02-14 Daigo Moriwaki <daigo at debian dot org>
215
316 * util/statistics.rb:
--- a/shogi_server/time_clock.rb
+++ b/shogi_server/time_clock.rb
@@ -125,11 +125,6 @@ class ChessClockWithLeastZero < ChessClock
125125 super
126126 end
127127
128- def time_duration(mytime, start_time, end_time)
129- t = end_time - start_time
130- return t.floor
131- end
132-
133128 def to_s
134129 return "ChessClockWithLeastZero: LeastTimePerMove %d; TotalTime %d; Byoyomi %d" % [@least_time_per_move, @total_time, @byoyomi]
135130 end
--- a/test/TC_time_clock.rb
+++ b/test/TC_time_clock.rb
@@ -79,6 +79,8 @@ class TestChessClockWithLeastZero < Test::Unit::TestCase
7979 assert_equal(1, tc.time_duration(1, 100, 101)) # 1
8080 assert_equal(2, tc.time_duration(100, 100.1, 102.9)) # 2.8
8181 assert_equal(2, tc.time_duration(100, 100, 102)) # 2
82+
83+ assert_equal(0, tc.time_duration(100, 100, 99.9)) # -0.1
8284 end
8385
8486 def test_time_duration_over_thinking_time