When using the time_put facet the output fails to add leading 0's to either the %y,%j or %W formats, even though the strftime spec says they should.
using namespace std;
int main ()
locale loc; // "C" locale
// get time_put facet:
const time_put<char>& tmput = use_facet <time_put<char> > (loc);
time ( ×tamp );
tm * now = localtime ( ×tamp );
now->tm_year = 6;
char pattern="Now it's: %j %W %y \n";
tmput.put ( cout, cout, ' ', now, pattern, pattern+sizeof(pattern)-1 );
cout << "Now it's: ";
tmput.put ( cout, cout, ' ', now, 'X');
cout << endl;
Note lack of leading zeros in output.
Log in to post a comment.