Towards a general theory of action and time