Subject: Re: Beta 18 breaks gettimeofday
From: [email-masked] (Barry Fishman)

28 May 1997 01:36:56 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
References: <[email-masked]>
Original-To: [email-masked]
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: [email-masked]

>From: Jonathan Wilkins <[email-masked]>
> 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
"[email-masked]" with one line of text: "help".