add function for calculating timestamps