diff --git a/TestConcoreHpp.cpp b/TestConcoreHpp.cpp index 72084be..ee0c3c7 100644 --- a/TestConcoreHpp.cpp +++ b/TestConcoreHpp.cpp @@ -280,6 +280,19 @@ static void test_default_maxtime_reads_file() { rm("in1/concore.maxtime"); } +static void test_default_maxtime_keeps_fraction() { + setup_dirs(); + write_file("in1/concore.maxtime", "2.5"); + + Concore c; + c.delay = 0; + c.default_maxtime(100); + + check("default_maxtime from file==2.5", c.maxtime == 2.5); + + rm("in1/concore.maxtime"); +} + static void test_default_maxtime_fallback() { rm("in1/concore.maxtime"); @@ -392,6 +405,7 @@ int main() { // default_maxtime() test_default_maxtime_reads_file(); + test_default_maxtime_keeps_fraction(); test_default_maxtime_fallback(); // tryparam() diff --git a/concore.hpp b/concore.hpp index 6f2d7b7..4efb652 100644 --- a/concore.hpp +++ b/concore.hpp @@ -91,7 +91,7 @@ class Concore{ double delay = 1; int retrycount = 0; double simtime; - int maxtime = 100; + double maxtime = 100; map iport; map oport; map params; @@ -1125,9 +1125,9 @@ class Concore{ * @brief Sets maxtime from the concore.maxtime file, falling back to defaultValue. * @param defaultValue The fallback value if the file is missing. */ - void default_maxtime(int defaultValue){ - maxtime = (int)concore_base::load_maxtime( - inpath + "1/concore.maxtime", (double)defaultValue); + void default_maxtime(double defaultValue){ + maxtime = concore_base::load_maxtime( + inpath + "1/concore.maxtime", defaultValue); } /**