Converted from gmmktime to time for sync