Message-ID: <3A2D5F67.855D0CB6@raytheon.com> From: Derek Stuhmer X-Mailer: Mozilla 4.75 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: Converting an ascii time to time_t References: <8ugpiu$65s$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 27 Date: Tue, 05 Dec 2000 15:34:31 -0600 NNTP-Posting-Host: 147.25.199.49 X-Complaints-To: news AT ext DOT ray DOT com X-Trace: dfw-service2.ext.raytheon.com 976052237 147.25.199.49 (Tue, 05 Dec 2000 15:37:17 CST) NNTP-Posting-Date: Tue, 05 Dec 2000 15:37:17 CST Organization: Raytheon Company To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hans-Bernhard Broeker wrote: > > Damian Yerrick wrote: > > How can a DJGPP program convert two different time formats to time_t, > > using POSIX functions? > > If I'm not totally mistaken after consulting some Unix systems' > manpages, you can't. At least not easily. The function you would need > is strptime(). But that doesn't seem to be required even by POSIX. [snip] > It might be a good idea to emulate strptime(), and only compile it in > if the system you're compiling on doesn't provide strptime(), itself. > > AFAIK, DJGPP does not have strptime(). I ran into this problem a few months back. I started writing my own version of strptime() to handle the few cases I wanted to deal with. Then, I ran across a version (I don't remember where) released into the public domain by Jim Nutt and modified by Rob Duff. I found a bug in the code (w.r.t. the version I used to use on SunOS 4.1.3) and modified it accordingly. If you want, send me an e-mail and I can forward you a copy of the C source code for strptime(). [Though let me clean it up a bit first, I'm embarrassed by the commented out code and undocumented 'fix'. ;-) ] -- Derek Stuhmer stuhmer AT raytheon DOT com