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

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

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

Post by Guest »

[email protected] wrote:
> Ethan Galstad schrieb am 11.08.2009
> 18:53:06:
>
>> Index: nagios.c
>> ===================================================================
>> 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=find_timeperiod("247_exclusion");
>> + time(&now);
>> + pref_time=now;
>> + get_next_valid_time(pref_time,&valid_time,tp);
>> + printf("=====\n");
>> + printf("CURRENT: %lu = %s",(unsigned long)now,ctime(&now));
>> + printf("PREFERRED: %lu = %s",(unsigned long)pref_time,ctime
>> (&pref_time));
>> + printf("NEXT: %lu = %s",(unsigned long)valid_time,ctime
>> (&valid_time));
>> + printf("=====\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

Good catch for only one coffee. :-) Its actually some internal
debugging code I added that intentionally gets left out of the compiled
version.


- Ethan Galstad





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