uint_least32_t mask;
if (game_check_goal(&state->board)) {
- printf("You win!\n");
- game_finish(&state->board);
+ int_fast32_t ms = game_finish(&state->board);
+ unsigned min, sec;
+
+ /* Negative time just means clock jumps and
+ * display headaches. */
+ if (ms < 0)
+ ms = 0;
+
+ sec = ms / 1000, ms %= 1000;
+ min = sec / 60, sec %= 60;
+ printf("You won! Time was %u:%.2u:%.3u\n",
+ min, sec, (unsigned)ms);
}
/* Figure out which tiles changed */