minor cache-bug
Christian Magnusson <mag <at> mag.cx>
2009-07-02 06:35:13 GMT
I noticed that there is probably some minor bug in the cache-timeout... I
did some tests with adding a test-device which worked as a clock.
The device had files like second, minute, hour, hhmmss, yyyymmdd etc.
All timeout values were set to fc_second, which should cache the values for
one second.
The time-data were fetched with:
time_t t = time(NULL);
struct tm *tm = localtime(&t);
and then I returned tm->tm_sec when reading the file
F1.000000000000/second
The problem was that reading the "second"-file inside a loop, I only got
even or odd seconds, eg. It was cached 2 seconds instead of 1.
Changing a compare-operator in ow_cache.c fixed the problem, and I can't see
any other side effects.
In ow_cache.c:Cache_Get_Common()
- if (duration[0] >= 0) {
+ if (duration[0] > 0) { // should probably be >, since
fc_second cache for 2 seconds...
/Christian
------------------------------------------------------------------------------