calculate job duration