- minor improvements and bug fixes

This commit is contained in:
zolliker
2010-09-02 11:43:46 +00:00
parent b74bcafc7a
commit 7644fe66e2
3 changed files with 11 additions and 4 deletions

View File

@ -299,7 +299,7 @@ int LoggerWrite(Logger * log, time_t now, int period, char *value)
if (now > omitCheck + 5) { /* check for omitted values only every 5 seconds */ if (now > omitCheck + 5) { /* check for omitted values only every 5 seconds */
for (p = list; p != NULL; p = p->next) { for (p = list; p != NULL; p = p->next) {
if (p->omitTime > 0 && now > p->omitTime + p->period) { if (p->omitTime > 0 && now > p->omitTime + p->period) {
snprintf(buf, sizeof buf, "%g", p->omitValue); snprintf(buf, sizeof buf, "%.7g", p->omitValue);
LoggerWrite0(p, p->omitTime, p->period, buf); LoggerWrite0(p, p->omitTime, p->period, buf);
p->omitTime = 0; p->omitTime = 0;
} }

View File

@ -69,7 +69,7 @@ static void OutFloat(Compressor * c, Point p)
} else { } else {
if (c->omitEqual && c->written.y == p.y) if (c->omitEqual && c->written.y == p.y)
return; return;
snprintf(c->buf, sizeof(c->buf), "%g", p.y); snprintf(c->buf, sizeof(c->buf), "%.7g", p.y);
value = c->buf; value = c->buf;
} }
SCPrintf(c->pCon, eWarning, "%ld %s", (long) (p.t - c->written.t), SCPrintf(c->pCon, eWarning, "%ld %s", (long) (p.t - c->written.t),
@ -141,7 +141,7 @@ static void PutFinish(Compressor * c, time_t now)
if (c->type == NUMERIC) { if (c->type == NUMERIC) {
if (now > c->last.t + c->period) { /* copy last value to the actual time */ if (now > c->last.t + c->period) { /* copy last value to the actual time */
if (c->last.y != LOGGER_NAN) { if (c->last.y != LOGGER_NAN) {
snprintf(value, sizeof value, "%g", c->last.y); snprintf(value, sizeof value, "%.7g", c->last.y);
PutValue(c, now, value); PutValue(c, now, value);
} }
if (c->best.t > c->written.t) { if (c->best.t > c->written.t) {

View File

@ -74,8 +74,15 @@ static int CronTask(void *pData)
StatisticsEnd(old); StatisticsEnd(old);
MacroPop(); MacroPop();
if (iRet != TCL_OK) { if (iRet != TCL_OK) {
if (strcmp(pTcl->result, "stop") == 0) {
SCPrintf(self->pCon, eLogError, "sicscron script '%s' stopped",
self->pCommand);
self->iEnd = 0;
return 0;
}
SCPrintf(self->pCon, eLogError, SCPrintf(self->pCon, eLogError,
"ERROR in sicscron script: %s", pTcl->result); "ERROR in sicscron script '%s':", self->pCommand);
SCPrintf(self->pCon, eLogError, "ERROR: %s", pTcl->result);
} }
if (self->iEnd == 2) { /* dolater command */ if (self->iEnd == 2) { /* dolater command */
self->iEnd = 0; self->iEnd = 0;