Skip to content
Snippets Groups Projects
Commit cd976d62 authored by Jaime Arias's avatar Jaime Arias
Browse files

refactor: use static_cast in the GetTime function

parent 52035ca5
No related branches found
No related tags found
No related merge requests found
Pipeline #8739 failed with stages
in 1 minute and 15 seconds
......@@ -13,11 +13,6 @@
using namespace std;
// Fonction pour obtenir le temps actuel en secondes
double getTime() {
return (double)clock() / (double)CLOCKS_PER_SEC;
}
// Fonction pour afficher l'aide
void printHelp() {
std::cout
......@@ -82,14 +77,14 @@ int main(int argc, char *argv[]) {
// print the Graph
/* cout << g->toString() << endl; */
float start_time = getTime();
float start_time = GetTime();
// generate the regex
Lg languages = RegexGenerator::generate(g);
cout << "End RegexGenerator" << endl;
/* cout << "Language: " << RegexGenerator::language(languages) << endl; */
float expr_time = getTime() - start_time;
float expr_time = GetTime() - start_time;
cout << "\n Fin expreg time: " << expr_time << " seconds" << endl;
// vector of generated paths
......@@ -102,7 +97,7 @@ int main(int argc, char *argv[]) {
}
}
float paths_time = getTime() - expr_time;
float paths_time = GetTime() - expr_time;
cout << "\n Fin generate paths time: " << paths_time << " seconds" << endl;
cout << "nb of no null paths " << generate_paths.size() << endl;
......@@ -213,7 +208,7 @@ int main(int argc, char *argv[]) {
const operations_research::MPSolver::ResultStatus result_status =
solver->Solve();
float lp_time = getTime() - paths_time;
float lp_time = GetTime() - paths_time;
cout << "\n Fin PL time: " << lp_time << " seconds" << endl;
// Vérifiez que le problème a une solution optimale.
......@@ -280,7 +275,7 @@ int main(int argc, char *argv[]) {
// cout << "Statistics : ";
// cout << solver->iterations()<<endl;
float elapsed_time = getTime() - start_time;
float elapsed_time = GetTime() - start_time;
cout << "\nTotal time: " << elapsed_time << " seconds" << endl;
return 0;
}
......@@ -10,3 +10,7 @@ bool IsNumeric(const std::string &str) {
return std::all_of(str.begin(), str.end(), ::isdigit);
}
double GetTime() {
return static_cast<double>(clock()) / static_cast<double>(CLOCKS_PER_SEC);
}
......@@ -11,4 +11,10 @@
*/
bool IsNumeric(const std::string &str);
/**
* Get the current time
* @return the current time
*/
double GetTime();
#endif // UTILS_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment