aboutsummaryrefslogtreecommitdiffstats
path: root/plugin_huawei.c
diff options
context:
space:
mode:
authormichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2010-02-14 02:46:43 +0000
committermichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2010-02-14 02:46:43 +0000
commit2f27e641cea4f304e68a29ec1335b7b4215035c0 (patch)
tree999d81a271196edc22b7ba5460efb88e04ca1ff9 /plugin_huawei.c
parent3a23df4023621d147789140298d9adff6c2c5438 (diff)
downloadlcd4linux-2f27e641cea4f304e68a29ec1335b7b4215035c0.tar.gz
plugin_huawei-fix-interval-check_V2.patch from Jar
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1111 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'plugin_huawei.c')
-rw-r--r--plugin_huawei.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/plugin_huawei.c b/plugin_huawei.c
index fbcf503..69215fa 100644
--- a/plugin_huawei.c
+++ b/plugin_huawei.c
@@ -840,16 +840,16 @@ static void huawei_read_flowreport(const char *cmd)
static void my_quality(RESULT * result, RESULT * arg1)
{
int age;
- struct timeval now;
static struct timeval prev_age;
static double value;
- gettimeofday(&now, NULL);
age = age_diff(prev_age);
- if (age > MIN_INTERVAL && huawei_configured() == 1) {
- prev_age = now;
- huawei_read_quality(QUALITY);
+ if (age < 0 || age >= MIN_INTERVAL) {
+ gettimeofday(&prev_age, NULL);
+
+ if (huawei_configured() == 1)
+ huawei_read_quality(QUALITY);
}
/* Note: R2S stands for 'Result to String' */
@@ -888,17 +888,17 @@ static void my_quality(RESULT * result, RESULT * arg1)
static void my_mode(RESULT * result, RESULT * arg1)
{
int age;
- struct timeval now;
static struct timeval prev_age;
double value_num;
char *value_str, *mode_str;
- gettimeofday(&now, NULL);
age = age_diff(prev_age);
- if (age > MIN_INTERVAL && huawei_configured() == 1) {
- prev_age = now;
- huawei_read_sysinfo(SYSINFO);
+ if (age < 0 || age >= MIN_INTERVAL) {
+ gettimeofday(&prev_age, NULL);
+
+ if (huawei_configured() == 1)
+ huawei_read_sysinfo(SYSINFO);
}
if (strncmp(R2S(arg1), "text", 4) == 0) {
@@ -945,16 +945,16 @@ static void my_mode(RESULT * result, RESULT * arg1)
static void my_manuf(RESULT * result)
{
int age;
- struct timeval now;
static struct timeval prev_age;
char *value_str;
- gettimeofday(&now, NULL);
age = age_diff(prev_age);
- if (age > MIN_INTERVAL && huawei_configured() == 1) {
- prev_age = now;
- huawei_read_manuf(MANUF);
+ if (age < 0 || age >= MIN_INTERVAL) {
+ gettimeofday(&prev_age, NULL);
+
+ if (huawei_configured() == 1)
+ huawei_read_manuf(MANUF);
}
/* start with an empty string */
@@ -978,16 +978,16 @@ static void my_manuf(RESULT * result)
static void my_model(RESULT * result)
{
int age;
- struct timeval now;
static struct timeval prev_age;
char *value_str;
- gettimeofday(&now, NULL);
age = age_diff(prev_age);
- if (age > MIN_INTERVAL && huawei_configured() == 1) {
- prev_age = now;
- huawei_read_model(MODEL);
+ if (age < 0 || age >= MIN_INTERVAL) {
+ gettimeofday(&prev_age, NULL);
+
+ if (huawei_configured() == 1)
+ huawei_read_model(MODEL);
}
/* start with an empty string */
@@ -1011,16 +1011,16 @@ static void my_model(RESULT * result)
static void my_fwver(RESULT * result)
{
int age;
- struct timeval now;
static struct timeval prev_age;
char *value_str;
- gettimeofday(&now, NULL);
age = age_diff(prev_age);
- if (age > MIN_INTERVAL && huawei_configured() == 1) {
- prev_age = now;
- huawei_read_fwver(FWVER);
+ if (age < 0 || age >= MIN_INTERVAL) {
+ gettimeofday(&prev_age, NULL);
+
+ if (huawei_configured() == 1)
+ huawei_read_fwver(FWVER);
}
/* start with an empty string */
@@ -1044,16 +1044,16 @@ static void my_fwver(RESULT * result)
static void my_operator(RESULT * result)
{
int age;
- struct timeval now;
static struct timeval prev_age;
char *value_str;
- gettimeofday(&now, NULL);
age = age_diff(prev_age);
- if (age > MIN_INTERVAL && huawei_configured() == 1) {
- prev_age = now;
- huawei_read_operator(OPERATOR);
+ if (age < 0 || age >= MIN_INTERVAL) {
+ gettimeofday(&prev_age, NULL);
+
+ if (huawei_configured() == 1)
+ huawei_read_operator(OPERATOR);
}
/* start with an empty string */
@@ -1080,15 +1080,15 @@ static void my_flowreport(RESULT * result, RESULT * arg1)
unsigned int days, hours, mins, secs;
double value_num;
char value_str[32];
- struct timeval now;
static struct timeval prev_age;
- gettimeofday(&now, NULL);
age = age_diff(prev_age);
- if (age > MIN_INTERVAL && huawei_configured() == 1) {
- prev_age = now;
- huawei_read_flowreport(FLOWREPORT);
+ if (age < 0 || age >= MIN_INTERVAL) {
+ gettimeofday(&prev_age, NULL);
+
+ if (huawei_configured() == 1)
+ huawei_read_flowreport(FLOWREPORT);
}
if (strncmp(R2S(arg1), "uptime", 6) == 0) {