delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/05/28/01:36:56

From: bfishman AT es DOT com (Barry Fishman)
Subject: Re: Beta 18 breaks gettimeofday
28 May 1997 01:36:56 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <ucik9kl0yhe.fsf.cygnus.gnu-win32@nirvanah.corp.es.com>
References: <3 DOT 0 DOT 32 DOT 19970526122602 DOT 027fd614 AT silence DOT secnet DOT com>
Original-To: gnu-win32 AT cygnus DOT com
In-Reply-To: Jonathan Wilkins's message of Mon, 26 May 1997 12:26:03 -0600
X-Mailer: Gnus v5.4.55/Emacs 19.34
Original-Sender: owner-gnu-win32 AT cygnus DOT com

>From: Jonathan Wilkins <jwilkins AT secnet DOT com>
> in regards to this problem.. it was simply a problem with the returned
> result from gettimeofday().. all other *NIX's seem to return 0 on success,
> and the cygwin returns non-0 on success.. perhaps this should be changed..

According to the SunOS 5.5 man page:

NAME
     gettimeofday, settimeofday - get or set the date and time
....
RETURN VALUES
     A -1 return value indicates that an error occurred and errno
     has been set.

Ultrix (4.3) and IRIX (5.3) man pages state that -1 indicates error and 0
indicates success.

The portable thing to do seems to be checking the return value against -1.
This will work with the cygnus implementation.

  if (gettimeofday(tvp, NULL) == -1) {
     printf("failed\n error was : %s\n", strerror(errno));
  } ...


Barry

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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