I am in trouble with interpreting difftime
quantity in a log I have produced:
I measure duration for some method call, and I log it, with this syntax:
time_t end, start ;
time(&start);
obj->sqp_func(this);
time(&end);
t_time = difftime(end, start) ;
sqp << "time " << endl ;
sqp << (double) end << endl ;
sqp << (double) start << endl ;
sqp << (double) t_time << endl ;
where sqp
is of ofstream
type.
I get, where t_time
(with type double
) should be printed, the value 210.
Are those 210 seconds? Is it truncated, or floored?
How can I get result in seconds up to 2 floating points for instance?
difftime
returns difference in seconds of type double http://www.cplusplus.com/reference/clibrary/ctime/difftime/
- see this for detailed explanations