Relative perception of time: a mathematical model