Mail Archives: djgpp/2000/12/05/16:51:32
Hans-Bernhard Broeker wrote:
>
> Damian Yerrick <Bullcr_pd_yerrick AT hotmail DOT comremovebullcr_p> 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
- Raw text -