According to mike grommet:
> Still working on the date range searching issue...
>
> I'm getting some really weird values back from mktime...
>
> here is the tm structure that man mktime gives me:
>
> int tm_sec; /* seconds (0 - 60) */
> int tm_min; /* minutes (0 - 59) */
> int tm_hour; /* hours (0 - 23) */
> int tm_mday; /* day of month (1 - 31) */
> int tm_mon; /* month of year (0 - 11) */
> int tm_year; /* year - 1900 */
> int tm_wday; /* day of week (Sunday = 0) */
> int tm_yday; /* day of year (0 - 365) */
> int tm_isdst; /* is summer time in effect? */
> char *tm_zone; /* abbreviation of timezone name */
> long tm_gmtoff; /* offset from UTC in seconds */
>
>
> Ok, my web input form, is sending in defaluts (in this case, no specified
> start date, no specified end date)
> so the search range should default to Jan 1, 1970 -- Jan 19, 2038
>
> In both cases, I zero out the tm_sec, tm_min, tm_hour fields as I'm not
> overly concerned with them
>
> I threw some debug output into the buildMatchList routine, and here is what
> I see:
>
> The left side values, are the values coming in from the web based form...
> the right values are the values
> I'm setting them to in my code for the tm structure (startdate and enddate
> are tm structures)
>
>
> value for startmonth: 0, value for startdate.tm_mon: 0
> value for startday: 0, value for startdate.tm_mday: 1
> value for startyear: 0, value for startdate.tm_year: 70
> value for endyear: 0, value for enddate.tm_year: 138
> value for endmonth: 0, value for enddate.tm_mon: 0
> value for endday: 0, value for enddate.tm_mday: 19
> value for endyear: 0, value for enddate.tm_year: 138
> time_tstartdate = 21600 , time_tenddate = -1
>
>
> month 0, day 1, and year 70, should translate out to a Jan 1, 1970, which
> should present a time_t value of 0 right?
>
> and month 0, day 19, year 138 should translate out to Jan 19, 2038, which
> should be valid, even tho its the very last date a 32 bit time_t can store?
OK, taking a guess here. The two tm structures that you pass to mktime
aren't fully initialised, so mktime is probably doing something wierd.
I don't think it cares about tm_wday or tm_yday, but it probably does
care about all the time zone stuff. How about if before you set any of
the fields in the two tm structures, you intialise it to localtime's
contents? E.g:
time_t now = time((time_t *)0);
tm *lt = localtime(&now);
startdate = *lt;
enddate = *lt;
--
Gilles R. Detillieux E-mail: <[EMAIL PROTECTED]>
Spinal Cord Research Centre WWW: http://www.scrc.umanitoba.ca/~grdetil
Dept. Physiology, U. of Manitoba Phone: (204)789-3766
Winnipeg, MB R3E 3J7 (Canada) Fax: (204)789-3930
------------------------------------
To unsubscribe from the htdig3-dev mailing list, send a message to
[EMAIL PROTECTED] containing the single word "unsubscribe" in
the SUBJECT of the message.