correct the time count function