src/chess/pgn.c

changeset 101
d4f19182fdc2
parent 98
9cb41383540f
--- a/src/chess/pgn.c	Thu Apr 16 19:49:16 2026 +0200
+++ b/src/chess/pgn.c	Thu Apr 16 19:59:08 2026 +0200
@@ -205,8 +205,15 @@
         } else {
             fprintf(stream, "%s", gamestate->moves[i].string);
         }
-        
-        // TODO: move time and maybe other comments
+
+        /* add clock times when the game was under time control */
+        if (gameinfo->timecontrol) {
+            char clkstr[16];
+            unsigned clkmv = i + 2; /* time for the next move! */
+            uint16_t clk = remaining_movetime2(gameinfo, gamestate, clkmv);
+            print_clk(clk, clkstr, true);
+            fprintf(stream, " {[%%clk %s]}", clkstr);
+        }
         
         /* line break every 10 half-moves */
         if ((i+1) % 10)  {

mercurial