calculate lasttime