@@ -1 +1 @@
-273
+275
@@ -211,7 +211,7 @@ int sqlSetConf(config_key_t id, uint64_t value) {
*/
int sqlLogFlow(uint64_t sweep, uint64_t flow, uint64_t deltaT) {
- int rc = sqlExecute(string_sprintf("REPLACE INTO flowLog (sweep, flow, timestamp) "
+ int rc = sqlExecute(string_sprintf("INSERT INTO flowLog (sweep, flow, timestamp) "
"VALUES (%lld, %lld, %lld);", sweep, flow, deltaT));
if (rc != SQLITE_OK)
return EXIT_FAILURE;
@@ -275,8 +275,9 @@ void halIntFlow(void) {
timespec deltaT;
clock_gettime(CLOCK_REALTIME, &flowTimestep[flowIndex]);
timespec_diff(&flowTimestep[((flowIndex + 1) % 2)], &flowTimestep[flowIndex], &deltaT);
- if (sqlLogFlow(0, halGetFlow(), deltaT.tv_sec * 1000 + deltaT.tv_nsec/1000000)) {
- logger_error("coffee.cpp: Couldn't write brewcounter to database");
+
+ if (sqlLogFlow(1, halGetFlow(), deltaT.tv_sec * 1000 + deltaT.tv_nsec/1000000)) {
+ logger_error("hal.cpp: could not log flow to database!");
return;
}
flowIndex = (flowIndex + 1) % 2;