Occupation-times for functions with countable level sets and the regeneration of stationary processes