This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Beta 18 breaks gettimeofday



>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".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]