From 5ce9b5ad831aae00a7d28d77ccd1ec974f71835f Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 18 Sep 2008 17:17:47 +0200 Subject: TESTING COMMIT: commiting not fully correct code ... for the purpose of conducting a few external tests. This is a first approach at removing the time() call in the output, but it shows there are some subleties we need to address. --- action.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/action.c b/action.c index 5c5bdbe9..c3cd7db6 100644 --- a/action.c +++ b/action.c @@ -625,14 +625,43 @@ actionWriteToAction(action_t *pAction) dbgprintf("action not yet ready again to be executed, onceInterval %d, tCurr %d, tNext %d\n", (int) pAction->iSecsExecOnceInterval, (int) getActNow(pAction), (int) (pAction->iSecsExecOnceInterval + pAction->tLastExec)); + /* TODO: the time call below may use reception time, not dequeue time - under consideration. -- rgerhards, 2008-09-17 */ + pAction->tLastExec = getActNow(pAction); /* re-init time flags */ FINALIZE; } - pAction->f_time = pAction->tLastExec = getActNow(pAction); /* re-init time flags */ + + + /* TODO: move this to msg object or some other object. This is just for quick testing! + * ALSO, THIS DOES NOT YET WORK PROPERLY! + * The reason is that we do not know the DST status, which is major pain. I need to + * think about obtaining this information (or the actual Unix timestamp) when I + * create the reception timestamp, but that also means I need to preserve that information + * while in the on-disk queue. Also need to think about a few other implications. + * rgerhards, 2008-09-17 + */ + { + struct tm tTm; + tTm.tm_sec = pAction->f_pMsg->tRcvdAt.second; + tTm.tm_min = pAction->f_pMsg->tRcvdAt.minute; + tTm.tm_hour = pAction->f_pMsg->tRcvdAt.hour; + tTm.tm_mday = pAction->f_pMsg->tRcvdAt.day; + tTm.tm_mon = pAction->f_pMsg->tRcvdAt.month - 1; + tTm.tm_year = pAction->f_pMsg->tRcvdAt.year - 1900; + /********************************************************************************/ + tTm.tm_isdst = 1; /* TODO THIS IS JUST VALID FOR THE NEXT FEW DAYS ;) TODO */ + /********************************************************************************/ + pAction->f_time = mktime(&tTm); +dbgprintf("XXXX create our own timestamp: %ld, system time is %ld\n", pAction->f_time, time(NULL)); + } + + //pAction->f_time = getActNow(pAction); /* re-init time flags */ /* Note: tLastExec could be set in the if block above, but f_time causes us a hard time * so far, I do not see a solution to getting rid of it. -- rgerhards, 2008-09-16 */ + + /* When we reach this point, we have a valid, non-disabled action. * So let's enqueue our message for execution. -- rgerhards, 2007-07-24 */ -- cgit