Add generic time slicing function