X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:references:in-reply-to:subject:date :message-id:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=fhL4eE5Hy9oPAxB6/aGXWODSb8F+nbp2jqy5G0GKKYz 5LdWpm4+v+6JEIjnXBBBs6fV5x77LcizNhna+pJlEZtWTZ2DdVATZiS5GYWGDAlR jV7d0pZ8wXZyjQsTqnflijoQ+oZOBpZzWA9e0klgU2tmWrxaVDIvnm6j17YVe2zU = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:references:in-reply-to:subject:date :message-id:mime-version:content-type:content-transfer-encoding; s=default; bh=me6nfeTbgy7b4S7Ig1WkFgyLa4E=; b=WDcf+QHSTs+M8vjKO KcBqJl08BWfB3JFP+KlqWzg4ktaW1mbu2I3u3Qbu1MaQMPGZviyZfUkdmrl6FA/H HUTmKjcALFGo44vh9uynmg8zmlZYMijeIC4O74x4APLZ86SGT7IEBs28cCf+Mr5Q 7JMOz+0Oal4BfW7uO8C1Z5/8e8= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_50,GIT_PATCH_2,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=inglis, tlaketwcnyrrcom, Inglis, sk:tlaket X-HELO: dnvrco-cmomta02.email.rr.com From: To: References: <78512bbe-b912-9bf5-d6cf-9da5b982c955 AT SystematicSw DOT ab DOT ca> In-Reply-To: <78512bbe-b912-9bf5-d6cf-9da5b982c955@SystematicSw.ab.ca> Subject: RE: Bug in TIME function Date: Fri, 13 Sep 2019 07:27:21 -0400 Message-ID: <016201d56a26$37271f70$a5755e50$@twcny.rr.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id x8DBS64q001769 In Linux it returns a time value and return code of 0: tom AT LinuxPC:~/Downloads$ ./timetest return value 10452 errno 0 Success tom AT LinuxPC:~/Downloads$ ./timetest return value 14048 errno 0 Success -----Original Message----- From: Brian Inglis Sent: Thursday, September 12, 2019 02:45 PM To: cygwin AT cygwin DOT com Subject: Re: Bug in TIME function On 2019-09-12 12:05, tlake AT twcny DOT rr DOT com wrote: > The code below returns -1. It shouldn't. > #include > #include > int main(int argc, char *argv[]) > { > printf("return value %ld\n", (long)times((struct tms*)0)); > return 0; > } It should. The times(3) function requires a pointer to object storage to return the results which are its function. An invalid pointer to object storage is an error, requiring -1 be returned and errno set. You should also print errno and strerror(errno). -- Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada This email may be disturbing to some readers as it contains too much technical detail. Reader discretion is advised. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple