Technically, if we follow the definition of what a function is, we could say that it is possible to represent time as a function of the distance.
However, time is nearly always, if not always, the independent variable (since it is not really dependent on anything, it is always passing). So, we actually would say that the distance to the library is a function of time, not the other way around.