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.