internal export interface Time { hours : number ; minutes : number ; seconds : number ; } param time returns internal export function timeToSeconds ( time ) { if ( time ) { return Math . floor ( time . seconds + time . minutes * 60 + time . hours * 3600 ) ; } throw Error ( 'The given time is not valid.' ) ; } param n returns internal export function secondsToTime ( n ) { if ( n <= 0 ) { return { hours : 0 , minutes : 0 , seconds : 0 } ; } const hours = Math . floor ( n / 3600 ) ; const restFromHours = n % 3600 ; const minutes = Math . floor ( restFromHours / 60 ) ; const seconds = restFromHours % 60 ; return { hours , minutes , seconds } ; }