fixed the timestamp variable calculation