Internationalization and localization tools


C/C++ Date and Time Functions

char *strptime(const char *s, const char *fmt, struct tm *tp);

Internationalization (I18n) Function Overview

The strptime function parses the input string s according to the format string fmt and stores its results in the structure tp.

The format string consists of the same components as the format string of the strftime function. The only difference is that the flags _, -, 0, and ^ are not allowed. Several of the distinct formats of strftime do the same work in strptime since differences like case of the input do not matter.

For details on the format string, more can be found in the Time-String-Parsing section of the GNU manual.

I18n Issues

There is no ANSI wide character version of this function. The parameters will have to be converted to multibyte UTF-8 characters and then the strptime function can be used. Similarly, the return value will then need to be converted from multibyte UTF-8 characters back to wide characters.

The format string used will have to be examined in detail to see if it is adequate for an internationalized application. This is quite dependent on where the string that is being parsed came from.

For example, if the string is a canonical form of date/time that is locale-independent most likely nothing will have to change in regards to formatting. This could happen possibly if an application has strings stored in a canonical form in a database, or uses a protocol that has a locale-independent string format.

Another example, if the string was created by an earlier call in the application to strftime, then you will have to save the format string used in the strftime call so it can be used by strptime to parse the string later.

Recommended Replacements*

*If you're already using the recommended function, see I18n Issues for other reasons why Globalyzer is detecting the function.

C/C++ Date, Time, and Currency Functions

 

Lingoport internationalization and localization services and software