From: noer@cygnus.com (Geoffrey Noer)
Subject: Re: Beta 18 breaks gettimeofday
27 May 1997 17:43:24 -0700
Approved: cygnus.gnu-win32@cygnus.com
Distribution: cygnus
Message-ID: <199705271948.MAA23262.cygnus.gnu-win32@cirdan.cygnus.com>
Content-Type: text
Original-To: jwilkins@secnet.com (Jonathan Wilkins)
Original-Cc: gnu-win32@cygnus.com
In-Reply-To: <3.0.32.19970526122602.027fd614@silence.secnet.com> from "Jonathan Wilkins" at May 26, 97 12:26:03 pm
X-Mailer: ELM [version 2.4 PL23]
Original-Sender: owner-gnu-win32@cygnus.com

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