added support for pure-Javascript time calculations