in reply to conversion of time intervals

localtime and gmtime will do.
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = gmtime($sec);
At least it will gve you: You'll have to take care of leap years of course.