Question: I hope someone had the same problem before, and asking here is quicker than the trial and error. 

I have a Java 8 project, where I am trying to use Liquibase, and generate my changelog from my Entities:

```
liquibase --changeLogFile=changeLog.yaml 
          --url=hibernate:spring:com.example.domain?dialect=org.hibernate.dialect.MySQL5InnoDBDialect 
          --logLevel=debug generateChangeLog

```

I got the following error:

```
SEVERE 11/04/15 09:55: liquibase: Failed to scan classpath for unlisted classes
liquibase.exception.DatabaseException: javax.persistence.PersistenceException: Failed to scan classpath for unlisted classes
...
Caused by: org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet: file [.../Example.class]; ...

```

I compiled my project using Java 7, and liquibase works fine.

Liquibase Version: 3.3.2  

Liquibase Hibernate4.2 Version: 3.5

As liquibase is open source, I can try and rebuild it using Java 8, but I have no idea if it will help.

Answer: 
If available (C++11) you could use chrono.

```
#include <chrono>

auto start = std::chrono::system_clock::now();
KnnClassifier.train( trainData, classes, Mat(), false, 1 );
auto end = std::chrono::system_clock::now();
auto time = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
cout << " Training time (s) = " << time.count() << "\n";  

```
The question is old but the posted answer in my opinion is not what should be used when working with OpenCV.

To measure time of an operation, OpenCV provides functions to do that. You can consult [official documentation for that](https://docs.opencv.org/master/db/de0/group__core__utils.html#ga705441a9ef01f47acdc55d87fbe5090c).
Here's the code to write:

```
double t = (double)getTickCount();
// do something ...
t = ((double)getTickCount() - t)/getTickFrequency();

```

Another way is use `TickMeter` object in OpenCV.
Here's a description of `TickMeter` class from official documentation also:

> 
> a Class to measure passing time.
> 
> 
> The class computes passing time by counting the number of ticks per
>  second. That is, the following code computes the execution time in
>  seconds:
> 
> 
> 
> ```
> TickMeter tm;
> tm.start();
> // do something ...
> tm.stop();
> std::cout << tm.getTimeSec();
> 
> ```
> 
> It is also possible to compute the average time over multiple runs:
> 
> 
> 
> ```
> TickMeter tm;
> for (int i = 0; i < 100; i++)
> {
>     tm.start();
>  // do something ...
>     tm.stop();
> }
> double average_time = tm.getTimeSec() / tm.getCounter();
> std::cout << "Average time in second per iteration is: " << average_time << std::endl;
> 
> ```
> 
>