We investigate finite-state systems with costs. Departing from classical theory, in this paper the cost of an action does not only depend on the state of the system, but also on the time when it is executed. We first characterize the terminating behaviors of such systems in terms of rational formal power series. This generalizes a classical result of Schützenberger. Using the previous results, ...