reusable latestTimespamp function (used in two places)