Mercurial > garten
view clock.c @ 14:bbc214c6fa6f
fixed the result of an unchecked rename ...
author | meillo@marmaro.de |
---|---|
date | Wed, 23 Jul 2008 16:39:06 +0200 |
parents | 8db6497d6065 |
children | 5e6c9260913a |
line wrap: on
line source
#include <stdio.h> #include <stdlib.h> #include "db.h" #include "game.h" void inc_time() { /* get current time */ sprintf(query, "select time from game;"); db_query(query); if (sqlite3_step(stmt) == SQLITE_ROW) { gametime = sqlite3_column_int(stmt, 0); } else { fprintf(stderr, "error: %s\n", sqlite3_errmsg(db)); } sqlite3_finalize(stmt); /* increment time */ sprintf(query, " update game set time = '%d';", ++gametime); if (!db_update(query)) { printf("error: time update failed: %s\n", sqlite3_errmsg(db)); } sqlite3_finalize(stmt); } void worldclock(void) { inc_time(); printf("gametime: %d\n", gametime); }