1. 예제
#include
float elapsed_time( struct timeval t0, struct timeval t1 );
main()
{
int pid, ppid;
struct timeval tp1, tp2;
gettimeofday(&tp1, NULL);
switch(pid = fork())
{
case -1
perror("synchro");
exit(1);
case 0
gettimeofday(&tp2, NULL);
printf("child%d my parent %dfork time = %f\n", \
getpid(), getppid(), elapsed_time( tp1, tp2 ) );
default
gettimeofday(&tp2, NULL);
printf("parent%d fork time = %f\n", getpid(),elapsed_time