timing function
scripted update of code from master at 8e8d636 timing function