slight variation of my own script there http://www.hawkee.com/snippet/3556/
the addition of the extra time paramaters is interesting though.. i just used $time