lundi 2 janvier 2017

Why does std::chrono::time_point not behave as expected?

#include <chrono>

int main()
{
    using clock = std::chrono::system_clock;
    using time_point = std::chrono::time_point<clock>;

    auto tp_now = clock::now();
    auto tp_min = time_point::min();

    bool b1 = tp_now > tp_min;
    bool b2 = (tp_now - tp_min) > std::chrono::seconds{ 0 };
    cout << boolalpha << b1 << endl << b2 << endl;
}

The expected output is:

true

true

But the actual output is:

true

false

Why does std::chrono::time_point not behave as expected?

Aucun commentaire:

Enregistrer un commentaire