Detecting time on a sensor

yes i mean when it is no longer flat. How would I go about logging the time that the changes occur, sorry to sound stupid I'm very new to all this.