How to write time?

Hi, im new in stereo matching. Just want to ask after running the coding for stereo matching,i realized there are time does not appear in .txt file. I want to take the time from “duration”

sm->CostCompute(ccMtd);
sm->CostAggre(caMtd);
sm->Match();
sm->PostProcess(ppMtd);
////////////////////////////////////////////////////////////
duration = static_cast<double>(getTickCount()) - duration;
duration /= cv::getTickFrequency(); // the elapsed time in sec
									   printf("\n--------------------------------------------------------\n");
printf("Total Time: %.2lf s\n", duration);
printf("--------------------------------------------------------\n");
	
Mat lDis = sm->getLDis();
//Mat rDis = sm->getRDis();

#ifdef training

   if (loopin == 0) {
       lDis.convertTo(lDis, CV_32FC1);
       WriteFilePFM(lDis, "result/trainingQ/Adirondack/disp0NZT.pfm");
       printf("write Adirondack\n");
   }
   else if (loopin == 1) {
	 lDis.convertTo(lDis, CV_32FC1);
	 WriteFilePFM(lDis, "result/trainingQ/ArtL/disp0NZT.pfm");
	 printf("write ArtL\n");

It should appear time right this. Does anything coding line was missing?
Capturess

this problem has nothing to do with stereo matching or any part of OpenCV.

this snippet of code shows no indication of writing a text file.

your question is off-topic for this forum.