Question

Why C++ standard support function strftime() but not strptime()? strftime() is available to change a time to string, but there isn't a function which can change a string back to time.

On Posix strptime() is available as a C-like function, using it need to take care of the potential problem of mixed C and C++ code.

Was it helpful?

Solution

I'm not a part of the standards committee, but here goes:

strptime is defined by the ISO/IEC 9945 documents (essentially the Single Unix Specification / POSIX). It is not part of the 9899:1990 or 9899:1999 C standards documents (and I don't think it is part of 9899:2011, though I can't be sure as I don't have that one in my possession yet).

Since the C++ standards only mandate levels of compatibility with their C cousin, you won't find strptime mandated by the 14882:1998 or 14882:2011 C++ standards documents.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top