Upgrade to Bonanza 6.0
[bonanza.git] / time.c
diff --git a/time.c b/time.c
index 203c3bf..fbeb04a 100644 (file)
--- a/time.c
+++ b/time.c
@@ -7,7 +7,7 @@
 #include "shogi.h"
 
 
-void
+void CONV
 set_search_limit_time( int turn )
 /*
   [inputs]
@@ -46,7 +46,16 @@ set_search_limit_time( int turn )
       time_max_limit = time_limit = UINT_MAX;
       return;
     }
-  
+
+#if defined(USI)
+  if ( usi_mode != usi_off && usi_byoyomi )
+    {
+      time_max_limit = time_limit = usi_byoyomi;
+      Out( "- time ctrl: %u -- %u\n", time_limit, time_max_limit );
+      return;
+    }
+#endif
+
   /* not punctual to the time */
   if ( ! sec_limit && ( game_status & flag_time_extendable ) )
     {
@@ -69,7 +78,7 @@ set_search_limit_time( int turn )
       if ( u0 == 2U ) { u0 = 3U; }
 
       /* 'byo-yomi' is so long that the ordinary time-limit is negligible. */
-      if ( u0 < sec_limit_up * 3U / 2U ) { u0 = sec_limit_up * 3U / 2U; }
+      if ( u0 < sec_limit_up * 5U ) { u0 = sec_limit_up * 5U; }
     
       u1 = u0 * 5U;
 
@@ -115,8 +124,8 @@ set_search_limit_time( int turn )
 }
 
 
-int
-renovate_time( int turn )
+int CONV
+update_time( int turn )
 {
   unsigned int te, time_elapsed;
   int iret;
@@ -137,7 +146,7 @@ renovate_time( int turn )
 }
 
 
-void
+void CONV
 adjust_time( unsigned int elapsed_new, int turn )
 {
   const char *str = "TIME SKEW DETECTED";
@@ -162,7 +171,7 @@ adjust_time( unsigned int elapsed_new, int turn )
 }
 
 
-int
+int CONV
 reset_time( unsigned int b_remain, unsigned int w_remain )
 {
   if ( sec_limit_up == UINT_MAX )
@@ -187,7 +196,7 @@ reset_time( unsigned int b_remain, unsigned int w_remain )
 }
 
 
-const char *
+const char * CONV
 str_time( unsigned int time )
 {
   static char str[32];
@@ -208,7 +217,7 @@ str_time( unsigned int time )
 }
 
 
-const char *
+const char * CONV
 str_time_symple( unsigned int time )
 {
   static char str[32];
@@ -226,7 +235,7 @@ str_time_symple( unsigned int time )
 }
 
 
-int
+int CONV
 get_cputime( unsigned int *ptime )
 {
 #if defined(_WIN32)
@@ -269,7 +278,7 @@ get_cputime( unsigned int *ptime )
 }
 
 
-int
+int CONV
 get_elapsed( unsigned int *ptime )
 {
 #if defined(_WIN32)