script to count the total time in seconds