Page 1 of 1

[Nagios-devel] Antwort: [Nagios-checkins] nagios/base checks.c,

Posted: Wed Aug 12, 2009 6:49 am
by Guest
Dies ist eine mehrteilige Nachricht im MIME-Format.
--=_alternative 002AEB9EC1257610_=
Content-Type: text/plain; charset="utf-8"
content-transfer-encoding: quoted-printable

Ethan Galstad schrieb am 11.08.2009=20
18:53:06:

> Index: nagios.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: /cvsroot/nagios/nagios/base/nagios.c,v
> retrieving revision 1.172
> retrieving revision 1.173
> diff -C2 -d -r1.172 -r1.173
> *** nagios.c 31 Jul 2009 16:54:20 -0000 1.172
> --- nagios.c 11 Aug 2009 16:53:04 -0000 1.173
> ***************
> *** 607,610 ****
> --- 607,625 ----
> }
>=20
> + #undef TEST_TIMEPERIODS
> + #ifdef TEST_TIMEPERIODS
> + /* DO SOME TIMEPERIOD TESTING - ADDED 08/11/2009 */
> + time_t now, pref_time, valid_time;
> + timeperiod *tp;
> + tp=3Dfind_timeperiod("247_exclusion");
> + time(&now);
> + pref_time=3Dnow;
> + get_next_valid_time(pref_time,&valid_time,tp);
> + printf("=3D=3D=3D=3D=3D\n");
> + printf("CURRENT: %lu =3D %s",(unsigned long)now,ctime(&now));
> + printf("PREFERRED: %lu =3D %s",(unsigned long)pref_time,ctime
> (&pref_time));
> + printf("NEXT: %lu =3D %s",(unsigned long)valid_time,ctime
> (&valid_time));
> + printf("=3D=3D=3D=3D=3D\n");
> + #endif

Hi Ethan!

Am I totally blind or is this just a little bit weired code?
If you #undef TEST_TIMEPERIODS, there is no real sense in doing an
#ifdef TEST_TIMEPERIODS on the next line, or is there?
The compiler will optimize it out anyways.

Or is my C-foo blinded by the fact it's 9am and I didn't have my
second coffee yet? ;-)

Regards
Sascha



GFKL Financial Services AG
Vorstand: Dr. Peter J=C3=A4nsch (Vors.), J=C3=BCrgen Baltes, Dr. Tom Haverk=
amp
Vorsitzender des Aufsichtsrats: Dr. Georg F. Thoma
Sitz: Limbecker Platz 1, 45127 Essen, Amtsgericht Essen, HRB 13522
--=_alternative 002AEB9EC1257610_=
Content-Type: text/html; charset="utf-8"
content-transfer-encoding: quoted-printable

Ethan Galstad <[email protected]>
schrieb am 11.08.2009 18:53:06:

> Index: nagios.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: /cvsroot/nagios/nagios/base/nagios.c,v
> retrieving revision 1.172
> retrieving revision 1.173
> diff -C2 -d -r1.172 -r1.173
> *** nagios.c   31 Jul 2009 16:54:20 -0000   1.172
> --- nagios.c   11 Aug 2009 16:53:04 -0000   1.173
> ***************
> *** 607,610 ****
> --- 607,625 ----
>                 }
>  
> + #undef TEST_TIMEPERIODS
> + #ifdef TEST_TIMEPERIODS
> +       /* DO SOME TIMEPERIOD TESTING - ADDED 08/11/2009
*/
> +       time_t now, pref_time, valid_time;
> +       timeperiod *tp;
> +       tp=3Dfind_timeperiod("247_exclusion")=
;
> +       time(&now);
> +       pref_time=3Dnow;
> +       get_next_valid_time(pref_time,&valid_time,t=
p);
> +       printf("=3D=3D=3D=3D=3D\n");
> +       printf("CURRENT:   %lu =3D %s",(=
unsigned
long)now,ctime(&now));
> +       printf("PREFERRED: %lu =3D %s",(unsig=
ned
long)pref_time,ctime
> (&pref_time));
> +       printf("NEXT:      %lu
=3D %s",(unsigned long)valid_time,ctime
> (&valid_time));
> +       printf("=3D=3D=3D=3D=3D\n

...[email truncated]...


This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]