delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2001/02/17/10:24:58

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-developers-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-developers-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin-developers AT sources DOT redhat DOT com
Reply-To: <nhv AT cape DOT com>
From: "Norman Vine" <nhv AT cape DOT com>
To: <cygwin-developers AT cygwin DOT com>
Subject: RE: mktime() seting errno ??
Date: Sat, 17 Feb 2001 10:24:00 -0500
Message-ID: <000001c098f5$a863dbe0$a300a8c0@nhv>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook 8.5, Build 4.71.2232.26
Importance: Normal
In-Reply-To: <20010216224954.B19214@redhat.com>
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019