🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #1868

Re: tzset and Windows

#1868
From: Jeff Altman
Date: Wed, 27 Mar 1991 20:37
21 lines
1079 bytes
Well, it wasn't a windows problem.  Its a problem with
unclear documentation in Borland C++ (and probably every
other C Library reference manual.)

The problem is that gmtime and localtime both return 
pointers to structures that the manual refers to as
static structures that are re-written with each call.
What the manual does NOT say is that gmtime and localtime
both use the SAME static structure.

So:
	gmt = gmtime(&t) ;
	lt  = localtime(&t) ;
	printf (asctime(lt)) ;
	printf (asctime(gmt)) ;

both use the localtime value.


--
- Jeff (jaltman@ccmail.sunysb.edu)
Technical Details
Message-ID: <1991Mar27.203753.20851@sbcs.sunysb.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!udel!sbcs!sbpmt!altman
References: <1991Mar27.020414.2525@sbcs.sunysb.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!udel!sbcs!sbpmt!altman
From: altman@sbpmt.cs.sunysb.edu (Jeff Altman)
Newsgroups: comp.windows.ms.programmer
Subject: Re: tzset and Windows
Message-ID: <1991Mar27.203753.20851@sbcs.sunysb.edu>
Date: 27 Mar 91 20:37:53 GMT
References: <1991Mar27.020414.2525@sbcs.sunysb.edu>
Sender: usenet@sbcs.sunysb.edu (Usenet poster)
Organization: State University of New York at Stony Brook
Lines: 21