The first version takes the sequence of characters in the the range from pattern to pat_end, and interprets it as the C function strftime would do, by expanding any format tag (begining with a percentage sign, %) found.
The second version formats a single character (as if it was a specifier preceeded by a percentage sign in the previous version). Because some implementations allow for a format modifier in an strftime specifier before the format character itself, the function has an additional parameter, modifier, to process this.
See the reference for strftime for more details on the specifiers.
During its operation, the second version of this function in the generic template simply calls the virtual protected member do_put, which implements its functionality. On the other hand, the first version decomposes the sequence of characters pointed by pattern into regular characters, which are directly written, and format tags, which are individually exapanded by calling member do_put for each.
- Iterator pointing to the first character of the output sequence.
The sequence shall be large enough to accommodate for the whole expression.
iter_type is a member alias of the second template parameter of time_put (i.e., the facet's iterator type). This can be any output iterator. By default, this is an ostreambuf_iterator, allowing implicit conversions from ostream objects such as cout.
- Object of a class derived from ios_base (generally an output stream object). It is used to obtain formatting information.
- Fill character. The fill character is used in output insertion operations to fill spaces when the format requires some character padding.
char_type is a member alias of the first template parameter of time_put (i.e., the facet's character type).
- Pointer to an object of type struct tm (see ctime), whose data is formatted.
- pattern, pat_end
- Pointers to the beginning and ending characters of the pattern sequence. These characters are written to s without change, except the format tags, which are expanded into their corresponding time expressions before being written.
The range used is [pattern,pat_end), which contains all the characters between pattern and pat_end, including the character pointed by pattern but not the character pointed by pat_end.
charT is the first template parameter of time_put (i.e., the facet's character type).
- Individual format character. The function will format some of the information pointed by t into a sequence of characters as specified by this character, just as if it was preceded by a percentage sign in a format string passed to strftime.
- Some implementations allow for a format modifier in an strftime specifier before the format character itself.
A value of 0 ('\0') is interpreted as no modifier.
Return valueThe next character in the sequence right after the last one written.
iter_type is a member alias of time_put's second template parameter (i.e., the facet's iterator type).
Now it's: 12:29PM Now it's: 12:29:08
|strftime||Format time to string (function)|
|time_get::get_time||Read time (public member function)|