g++4.9仍然没实现put_time

代码如下:

//io/timemanipulator1.cpp
#include <iostream>
#include <iomanip>
#include <chrono>
#include <cstdlib>
using namespace std;

int main() {
    //process and print current date and time:
    auto now = chrono::system_clock::now();
    time_t t = chrono::system_clock::to_time_t(now);
    tm* nowTM = localtime(&t);
    cout << put_time(nowTM,"date: %x\ntime:: %X\n") << endl;

    //read date
    /* tm* date; cout << "new date: "; cin >> get_time(date, "%x"); //read date if(!cin) { cerr << "invalid format read" << endl; } */
}

在g++4.9.3上的编译结果:

你可能感兴趣的:(g++4.9仍然没实现put_time)