dimanche 19 mai 2019

C++: setting time using prefixes

Tell me, does the following exist in C ++ 11/14/17:

1) set time using time prefixes

double time1 = 1s; // time1 = 1.0
double time2 = 2m; // time2 = 120.0
double time3 = 7ms; // time3 = 0.007 

2) get the string value of the time with the prefix as set

std::cout << getTime(time1); // cout 1s
std::cout << getTime(time2); // cout 2s
std::cout << getTime(time3); // cout 7ms

Aucun commentaire:

Enregistrer un commentaire