Beta 18 breaks gettimeofday

Barry Fishman bfishman@es.com
Tue May 27 22:31:00 GMT 1997


>From: Jonathan Wilkins <jwilkins@secnet.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@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list