src/chess/pgn.c

changeset 181
8bda076d0a16
parent 178
724e8acff6f8
child 182
04c65336777f
equal deleted inserted replaced
180:0fed680c487c 181:8bda076d0a16
275 if (gamestate->movecount == 0) { 275 if (gamestate->movecount == 0) {
276 struct timeval curtimestamp; 276 struct timeval curtimestamp;
277 gettimeofday(&curtimestamp, NULL); 277 gettimeofday(&curtimestamp, NULL);
278 dateseconds = curtimestamp.tv_sec; 278 dateseconds = curtimestamp.tv_sec;
279 } else { 279 } else {
280 dateseconds = (time_t) gamestate->moves[0].timestamp.tv_sec; 280 dateseconds = (time_t) gamestate->moves[0].timestamp.sec;
281 } 281 }
282 struct tm *tm = gmtime(&dateseconds); 282 struct tm *tm = gmtime(&dateseconds);
283 if (tm == NULL) { 283 if (tm == NULL) {
284 /* fallback - should never happen in reality */ 284 /* fallback - should never happen in reality */
285 strncpy(date, "????.??.??", sizeof(date)); 285 strncpy(date, "????.??.??", sizeof(date));
375 *(resp++) = '}'; 375 *(resp++) = '}';
376 376
377 /* elapsed move time */ 377 /* elapsed move time */
378 memcpy(resp, " {[%emt ", 8); 378 memcpy(resp, " {[%emt ", 8);
379 resp += 8; 379 resp += 8;
380 uint16_t emt = gamestate->moves[i].movetime.tv_sec; 380 uint16_t emt = gamestate->moves[i].movetime / 1000000ull;
381 resp += print_clk(emt, resp, true); 381 resp += print_clk(emt, resp, true);
382 *(resp++) = ']'; 382 *(resp++) = ']';
383 *(resp++) = '}'; 383 *(resp++) = '}';
384 } 384 }
385 385

mercurial