For elapsed time at the end of the backtest along with wall clock time which you can change for your timezone anywhere in the world.
Edit: List of time zones
2018-10-04 12:59 at_end:122 INFO Elapsed: 1 hr 3.1 min 2018-10-05 22:29 US/Eastern
import time
from datetime import datetime as dt
from pytz import timezone as tz
def at_end(context, data):
if get_datetime().date() != context.end_date: # only proceed if last day of backtest
return
tzone = 'US/Eastern'
elapsed = (time.time() - context.time_start) / 60 # Minutes
log.info('Elapsed: {} hr {} min {} {}\n'.format(
int(elapsed / 60), '%.1f' % (elapsed % 60),
dt.now(tz(tzone)).strftime('%Y-%m-%d %H:%M'), tzone))
# Elapsed: 1 hr 3.1 min 2018-10-05 22:29 US/Eastern
def initialize(context):
context.time_start = time.time() # seconds since 1970
context.end_date = get_environment('end').date()
schedule_function(at_end, date_rules.every_day(), time_rules.market_close())