memset(&tz,0,sizeof(tz)); gettimeofday(&tv2,&tz); printf("time taken to read the information from the pipe written by popen is %ld - %ld = %ld\n",tv2.tv_usec,tv1.tv_usec,(tv2.tv_usec - tv1.tv_usec));
pclose(fp);
When the above snippet of code is embedded in one of the server coding, we get the time taken to read the information from pipe is around 9000 micro seconds, but when i run same snippet of code as a simple program, i get the time taken to read the information from the pipe about 50-60 micro seconds, can i know what might be the reason?