#!/usr/local/bin/python# encoding: utf-8"""*Report current time in various formats*Author: David Young"""from__future__importdivisionfrompast.utilsimportold_divfrombuiltinsimportobjectimportsysimportosimportmathimporttimeos.environ['TERM']='vt100'
[docs]classnow(object):""" *Report the current time into various formats* **Key Arguments** - ``log`` -- logger - ``settings`` -- the settings dictionary """# Initialisationdef__init__(self,log,settings=False,):self.log=loglog.debug("instansiating a new 'now' object")self.settings=settings# xt-self-arg-tmpx# Initial ActionsreturnNone
[docs]defget_mjd(self):""" *Get the current time as an MJD* **Return** - ``mjd`` -- the current MJD as a float **Usage** .. todo:: - add clutil - remove `getCurrentMJD` from all other code ```python from astrocalc.times import now mjd = now( log=log ).get_mjd() ``` """self.log.debug('starting the ``get_mjd`` method')jd=old_div(time.time(),86400.0)+2440587.5mjd=jd-2400000.5self.log.debug('completed the ``get_mjd`` method')returnmjd