kharri5 0 Junior Poster in Training

So I have asked a couple of questions already about this shell programming, but I have another yet again.

I'm not sure why my times function in this program isn't reporting the time right. It always says that I have 0 seconds of time for a process or some giant number. I cannot get CLK_TCK to be recognized even though I included time.h and limits.h just in case. What am I doing wrong. Also I need to be getting the time of the parent process - time of the child process but am not sure it's actually the time I'm getting. If someone could help me figure this out I would much appreciate it, cause I recieve little to no direction from my teachers and TAs

Here is the code so far:

void runProc(char* cmd[], int argSz)
{
    struct tms strt, end;
    pid_t pid;
    clock_t start, finish;
   
    // fork
    start =  times(&strt);
    pid = fork();
    switch(pid)  
    {
        case -1:
            cout << "Fork Failed" << endl;
            exit(-1);
        case  0:
            execvp(cmd[0], cmd);
            //iff execvp returns a value then that means it was not a proper process
                cout << cmd[0] << ": Command Not Found" << endl;
                exit(0);
        
        default:
        
            wait(NULL);
            finish = times(&end);
            //cout << "Process took: " <<(double) (end.tms_stime-strt.tms_stime)/CLK_TCK;
            //cout << " seconds" << endl;
            //cout << "Child has finished" << endl;
    }
    cout << "Process took: " << (finish-start);
    //cout << (end.tms_stime-strt.tms_stime)/CLK_TCK; //above line generates error saying must use function first
    cout << (end.tms_utime-strt.tms_utime);
    cout << " seconds" << endl;   
}