When submitting a job script to a PBS queuing system, a walltime is specified automatically or by the user e.g. via
#PBS -l walltime=1:00:00
This is stored in the environment variable $PBS_WALLTIME.
Of course, that is for TORQUE, I'm not sure which PBS queuing system you are using.
I was looking for an answer to this and the comments above gave me an idea that seems to work pretty well. You can use qstat and grab the pertinent information from it with sed:
qstat -f $PBS_JOBID | sed -rn 's/.*Resource_List.walltime = (.*)/\1/p'
Putting this in your PBS script will print out the value and you can use standard bash to store the output of this in a variable:
WALLTIME=$(qstat -f $PBS_JOBID | sed -rn 's/.*Resource_List.walltime = (.*)/\1/p')
You can also use this to get other information that is not available from the PBS_* environment variables such as the amount of memory allocated for the job and probably some other stuff.