lock time calculation in charts.py