Improved time stamp code