Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!decwrl!ads.com!killer!usenet From: anders@verity.com (Anders Wallgren) Newsgroups: comp.sys.mac.programmer Subject: Re: GetDateTime() problem Message-ID: <1991Jan31.022340.12265@verity.com> Date: 31 Jan 91 02:23:40 GMT References: Sender: usenet@verity.com (USENET News) Reply-To: anders@verity.com (Anders Wallgren) Organization: Verity, Inc., Mountain View, CA Lines: 23 In-Reply-To: rg2c+@andrew.cmu.edu (Robert Nelson Gasch) In article , rg2c+@andrew (Robert Nelson Gasch) writes: >I'm experiencing a strange problem when using the GetDateTime() function. >Given the following declarations and call it returns something like -26305. > >long seed; >GetDateTime (&seed); >printf ("%d", seed); > >The above statements return seed to be something like -26305 which is >obviously nonsense. If anybody has any idea what's wrong with this call, >please let me know as I want to use the value returned by GetDateTime() >as a seed for the random number generator. > >Thanx alot --> Rob pascal void GetDateTime(unsigned long *secs); You're passing it a long when you should be using an unsigned long - since the toolbox uses some day in 1904 (WHY do they do this? It seems REALLY gratuitous to go that far back), it's already wrapped past the maximum positive integer that can represented with a long - you must use an unsigned long.