, : parent clock , , clock fork.
:
#include <stdio.h>
#include <unistd.h>
#include <time.h>
#include <sys/types.h>
int main(void){
printf("Before fork\n");
pid_t pid_return = fork();
clock_t time = clock();
char* x;
if(pid_return != 0){
x = "Parent";
} else{
x = "Child";
}
printf("%s time : %f\n", x, (double)time);
}
child, , fork.
Before fork
Parent time : 2684.000000
Child time : 617.000000