implement get interval function