diff --git a/src/Benchmarks/SpMV/tnl-benchmark-spmv.h b/src/Benchmarks/SpMV/tnl-benchmark-spmv.h
index 1266a63c90692ba06b5f33d663aa07e486be3802..9bc924dee33f46c1ec7e90c27f424834f8539802 100644
--- a/src/Benchmarks/SpMV/tnl-benchmark-spmv.h
+++ b/src/Benchmarks/SpMV/tnl-benchmark-spmv.h
@@ -46,14 +46,9 @@ runSpMVBenchmarks( Benchmark & benchmark,
     benchmarkSpmvSynthetic< Real >( benchmark, inputFileName, verboseMR );
 }
 
-void
-setupConfig( Config::ConfigDescription & config )
+// Get current date time to have different log files names and avoid overwriting.
+std::string getCurrDateTime()
 {
-   config.addDelimiter( "Benchmark settings:" );
-   config.addRequiredEntry< String >( "input-file", "Input file name." );
-   
-   ////////////////
-   // Get current date time to have different log files names and avoid overwriting.
    // source: https://stackoverflow.com/questions/16357999/current-date-and-time-as-string
    time_t rawtime;
    struct tm * timeinfo;
@@ -62,8 +57,17 @@ setupConfig( Config::ConfigDescription & config )
    timeinfo = localtime( &rawtime );
    strftime( buffer, sizeof( buffer ), "%d-%m-%Y--%H:%M:%S", timeinfo );
    std::string curr_date_time( buffer );
-   ////////////////
-   config.addEntry< String >( "log-file", "Log file name.", "tnl-benchmark-spmv::" + curr_date_time + ".log");
+   
+   return curr_date_time;
+}
+
+void
+setupConfig( Config::ConfigDescription & config )
+{
+   config.addDelimiter( "Benchmark settings:" );
+   config.addRequiredEntry< String >( "input-file", "Input file name." );
+   
+   config.addEntry< String >( "log-file", "Log file name.", "tnl-benchmark-spmv::" + getCurrDateTime() + ".log");
    
    config.addEntry< String >( "output-mode", "Mode for opening the log file.", "overwrite" );
    config.addEntryEnum( "append" );