I have the following method which intakes std::chrono::milliseconds
void SomeMethod(std::chrono::milliseconds some_value) {
// some logic
}
I am able to call it in the following way:
using namespace std::chrono_literals;
SomeMethod(1000ms);
Works.
But, I want to call it in the following way by passing a member variable or some globally declared variable. Something like this,
using namespace std::chrono_literals;
std::chrono::system_clock::duration timeout = 3000ms;
But I get the following error:
error: no viable conversion from 'duration<[...], ratio<[...], 1000000>>' to 'duration<[...], ratio<[...], 1000>>'
SomeMethod(some_value);
^~~~~~~
Aucun commentaire:
Enregistrer un commentaire