Antwort: [Nagios-checkins] nagios/base checks.c, 1.170, 1.171 nagios.c, 1.172, 1.173 utils.c, 1.245, 1.246

Ethan Galstad egalstad at nagios.org
Wed Aug 12 15:52:33 CEST 2009


Sascha.Runschke at gfkl.com wrote:
> Ethan Galstad <egalstad at users.sourceforge.net> 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

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july




More information about the Developers mailing list