[prev in list] [next in list] [prev in thread] [next in thread] 

List:       netsaint-devel
Subject:    Re: [netsaint-devel] Bug in Scheduled Downtime and feature request
From:       Andreas Sorensen <Andreas.Sorensen () hydro ! com>
Date:       2001-06-19 8:46:11
[Download RAW message or body]


I can certainly confirm this behaviour (Solaris/Netsaint 0.7b3).
After not receiving any response when I reported the problem in
April, I had a closer look at the source code and believe the
problem is the string_to_time() function in file cmd.c, which
apparently doesn't handle Daylight Saving Time properly.

The first time the std library function mktime() is called from
string_to_time(), the Daylight Saving Time is not accounted for,
thus the start time of scheduled downtime will be one hour off.
The confusing thing is that the second (and subsequent) calls
to mktime() does account for DST (thus the end time will be
correct).

I have temporarily fixed the problem by inserting a line
"lt.tm_isdst = -1;" in cmd.c:string_to_time(), the negative
value should make mktime try to determine whether the alternate
timezone is in effect (according to the mktime man page).

It would be great if any of you Netsaint developers could
verify this solution to the start time problem.

Regards,
Andreas Sorensen

/* converts a time string to a UNIX timestamp */
int string_to_time(char *buffer, time_t *t){
	struct tm lt;

	sscanf(buffer,"%02d/%02d/%04d%02d:%02d:%02d",
		&lt.tm_mon,&lt.tm_mday,&lt.tm_year,&lt.tm_hour,
		&lt.tm_min,&lt.tm_sec);

	lt.tm_mon--;
	lt.tm_year-=1900;
	lt.tm_isdst = -1; # <- tell mktime to determine DST

	*t=mktime(&lt);

	return OK;
}


Kevin Simmons wrote:

> This is a re-run post because I have received no response to my

>  earlier one (and I'd like to get a response)...

> 
> Netsaint 0.0.7b4 on Solaris 8.
> 	In the Host and Service detail status screens under the

> Commands column on the right side, normally the second or third

> item down is "Schedule downtime for this host/service". 
> 	I used the Schedule downtime for several host entries today

> (06/01/01) as we are having a scheduled power outage. When I input

> the time as 16:00:00 for today and the ending time of 06/04/01

> 07:00:00 the result was:

> Start 06/01/01 17:00:00, End 06/04/01 07:00:00. I had to specify

> the start time one hour earlier to obtain the correct time. Would

> some of you please either confirm or deny the existence of this

> behavior in your environments?
> 	



_______________________________________________
Netsaint-devel mailing list
Netsaint-devel@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/netsaint-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic