Name

time_put class template — Facet for output of dates and times

Synopsis

template <typename charT, typename OutputIterator = ostreambuf_iterator<charT> >
class time_put : public locale::facet
{
public:
  typedef charT char_type;
  typedef OutputIterator iter_type;
  explicit time_put(size_t refs = 0);
  iter_type put(iter_type s, ios_base& f, char_type fill, const tm* tmb,
                const charT* pattern, const charT* pat_end) const;
  iter_type put(iter_type s, ios_base& f, char_type fill, const tm* tmb,
                char format, char modifier = 0) const;
  static locale::id id;
protected:
  virtual ~time_put(  );
  virtual iter_type do_put(iter_type s, ios_base&, char_type, const tm* t,
                           char format, char modifier) const;
};

The time_put class template is a facet for formatting and writing dates and times. The time_put<char> and time_put<wchar_t> instantiations are standard.

Note that time_put is unlike other facets. The public put function does not always directly call do_put. Here are the complete descriptions of put and do_put:

iter_type put (iter_type out, ios_base& stream, char_type fill, const tm* t, const charT* pattern, const charT* pat_end) const

Reads the pattern in [pattern, pat_end) and writes formatted date and time information to out. The pattern contains ordinary characters (which are written directly to out) interspersed with format specifiers. A format specifier starts with '%' and is followed by an optional modifier character, which is followed in turn by a format specifier character. The put function ...

Get C++ In a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.