It will not work in current sessions, but can (locally) work on future sessions. Modify / create the .Rprofile file in your home directory and add the following two lines:
.startedTime<-Sys.time() .sessionTime<-function() Sys.time()-.startedTime
Lines in .Rprofile are executed at the beginning of the session. I select names starting with a dot, so they do not return ls() . Then start the R session and when you give:
.sessionTime()
it will return the elapsed time from the start of the session.
source share