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


Jonathan Wilkins wrote:
> 
> 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..

Thanks.  The code now reads instead of always returning 1:

int
gettimeofday (struct timeval *p, struct timezone *z)
{
  /* FIXME: should return zero on success, -1 on failure */
  SYSTEMTIME t;
  FILETIME f;
  TIME_ZONE_INFORMATION tz;

  GetTimeZoneInformation (&tz);

  GetSystemTime (&t);
  /* FIXME: ignores tz */
  SystemTimeToFileTime (&t, &f);

  if (p)
    {
      totimeval (p, &f, tz.Bias * 60);
    }
  if (z)
    {
      z->tz_minuteswest = tz.Bias;
      z->tz_dsttime = tz.StandardBias != tz.Bias;
    }
  return 0;
}

More return code setting/checking needs to be added to this
and other functions in winsup/times.cc (and other files in winsup).
Hopefully returning zero will be a bit better than what was
there previously though...

-- 
Geoffrey Noer
noer@cygnus.com
-
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]