function to convert onset index to time