🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac
Article #19429

Re: LSC bug?

#19429
From: Andrew Singer
Date: Wed, 23 Sep 1987 13:27
46 lines
2098 bytes
In article <3320019@hpcid.HP.COM> tedj@hpcid.HP.COM (Ted Johnson) writes:
>I'm having a very wierd problem with Lightspeed C's time() and ctime()
>functions.  They both print out the correct time, except that they're both
>exactly 5 hours fast!!
>
> ...source example here...                               
>	

	I reproduced this behavior, and asked some questions, and looked
at the library sources, and it seems that the time() and ctime() functions
return Greenwich Mean Time (GMT), *not* local time. The fault lies with the
documentation for not reporting this little fact, and will be corrected.

If you need local time (or the machine's clock time) you can do something
with the OS Utilites and the International Utilities Package:

#include <MacTypes.h>
#include <stdio.h>
#include <OSUtil.h>
#include <IntUtilPkg.h> /* this may not be the right name? */

main()
{
	Str255 theDate, theTime;
	long secs;

	GetDateTime(&secs);
	IUDateString(secs, longDate, &theDate);
	IUTimeString(secs, TRUE, &theTime);

	printf("%s\n", &theDate);
	printf("%s\n", &theTime);
}

I haven't actually tested this, and it's not an exact replacement of the
unix time function, but it (or something like it) should work.
	

		--Rich

**Note: The opinions herein are my own opinions and are not necessarily
representative of the opinions of my employer (THINK Technologies, Inc.)

Richard M. Siegel
Customer Support Representative
THINK Technologies, Inc.
Technical Details
Message-ID: <2864@husc6.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!endor!singer
References: <3320019@hpcid.HP.COM>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!endor!singer
From: singer@endor.harvard.edu (Andrew Singer)
Newsgroups: comp.sys.mac
Subject: Re: LSC bug?
Message-ID: <2864@husc6.UUCP>
Date: Wed, 23-Sep-87 09:27:14 EDT
Article-I.D.: husc6.2864
Posted: Wed Sep 23 09:27:14 1987
Date-Received: Sat, 26-Sep-87 01:39:31 EDT
References: <3320019@hpcid.HP.COM>
Sender: news@husc6.UUCP
Reply-To: singer@endor.UUCP (Andrew Singer)
Organization: THINK Technologies, Inc, Bedford MA
Lines: 46
Keywords: time, LSC, libraries, bug
Summary: Bug is in docs, not libraries