Traditional clustering analysis only takes the distance factor into account. When the clustering conditions contain factors other than distance, using traditional clustering algorithm usually can't obtain feasible results. Based on the PAM clustering algorithm and combined with a certain application background, this paper proposes a clustering algorithm with time constraints for small-scale datasets called TCPAM and applies this algorithm to a mobile platform application. The algorithm introduces restrictions combining distance factor and time factor into the clustering process, so that to cluster the data objects by the “principle of proximity” and “time constraints” of the dual restrictions. The experimental results show that our algorithm can achieve a good clustering performance.