delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/05/27/17:43:24

From: noer AT cygnus DOT com (Geoffrey Noer)
Subject: Re: Beta 18 breaks gettimeofday
27 May 1997 17:43:24 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199705271948.MAA23262.cygnus.gnu-win32@cirdan.cygnus.com>
Original-To: jwilkins AT secnet DOT com (Jonathan Wilkins)
Original-Cc: gnu-win32 AT cygnus DOT 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 AT cygnus DOT 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 AT cygnus DOT com
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019