Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.sources.wanted Subject: Re: Public domain STRPTIME() Message-ID: <8444@auspex.auspex.com> Date: 20 Jun 91 23:17:41 GMT References: <1991Jun14.153947.1180@ednor.bbc.com> Distribution: usa Organization: Auspex Systems, Santa Clara Lines: 23 >I'm looking for a public domain implementation of strptime(), which is to >strftime() as scanf() is to printf(). Any leads would be appreciated. "strptime()" isn't completely the correct solution. It "knows about" some of the items in the format string, so that it "knows" that you can leave the seconds off in a time, and the like. A better solution would have been to have: 1) a routine that parses the input string strictly, requiring matches for all fields - i.e., a *true* analog to "scanf()"; 2) a routine that gets a list of format strings, and tries them in order with the first routine until it finds one that works. 1) should be a fair bit easier to write than "strptime()"; it should be fairly straightforward, if slightly tedious, to write. 2) should add less complication than the hacks in "strptime()". I.e., if you can avoid it, don't propagate the errors in specifying the interface that I made when I first created "strptime()"; do the above instead.