This is the mail archive of the cygwin-developers@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: mktime() seting errno ??


Christopher Faylor writes:
>
>On Fri, Feb 16, 2001 at 09:55:07PM -0500, Norman Vine wrote:
>>The attached test program demonstrates this.  
>>I have looked at the mktime source in newlib 
>>and can not see why this should be happening ?
>
>Have you debugged the problem in gdb?  It should be fairly easy
>to figure out what is going on.  

Yes I have stepped thru this in gdb
And it wasn't 'obvious' to me how to find out 
how errno was even being touched.

>At the very least you are going to have to provide an 
>explanation of why you think it shouldn't be failing.

1) calling mktime() with this tm structure does not set errno
on any other system that I have tested 

#include <errno.h>
#include <stdio.h>
#include <time.h>

struct tm mt;

void test(void) {
	mt.tm_sec = 0;
	mt.tm_min = 0;
	mt.tm_hour = 12;
	mt.tm_mday = 21;
	mt.tm_mon = 2;
	mt.tm_year = 98;
	mt.tm_isdst = 0;
	mktime(&mt);
}

int main(int argc, char **argv)
{
	errno = 0;
	test();
	printf("%d\n",errno);
	return errno;
}

2) I can find no reference to indicate that mktime() 
     should touch errno.  
     I believe ANSI only requires a return of -1 on failure.

< my apolgies for the zip file >

Cheers

Norman VIne


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]