www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/11/10/07:30:21

From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Converting an ascii time to time_t
Date: 10 Nov 2000 12:27:10 GMT
Organization: Aachen University of Technology (RWTH)
Lines: 20
Distribution: world
Message-ID: <8ugpiu$65s$1@nets3.rz.RWTH-Aachen.DE>
References: <j05n0t8b87cjho4ul7pdfkpd2th4u6pg78 AT 4ax DOT com>
NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 973859230 6332 137.226.32.75 (10 Nov 2000 12:27:10 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 10 Nov 2000 12:27:10 GMT
Originator: broeker@
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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.
Only the X/Open group standard set of library functions 'XPG4' seems
to include it.

So you'll have to parse the individual elements yourself by sscanf(),
fill them into 'struct tm' and mktime() that to get a 'time_t' value.

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(). 
-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019