For the theoretical difference multiply the bar difference with BarPeriod, for the real difference subtract wdate. You can find all time functions on the date/time page.