@classmethod
def round_time(cls, dt):
    """Round the given datetime object to the defaults.timing_resolution.

        Uses :class:`stalker.defaults.timing_resolution` as the closest number
        of seconds to round to.

        :param dt: datetime.datetime object, defaults to now.

        :type dt: datetime.datetime

        Based on Thierry Husson's answer in `Stackoverflow`_

        _`Stackoverflow` : http://stackoverflow.com/a/10854034/1431079
        """
    from stalker import defaults
    timing_resolution = defaults.timing_resolution
    trs = timing_resolution.days * 86400 + timing_resolution.seconds
    import datetime
    import pytz
    epoch = datetime.datetime(1970, 1, 1, tzinfo=pytz.utc)
    diff = dt - epoch
    diff_in_seconds = diff.days * 86400 + diff.seconds
    return epoch + datetime.timedelta(seconds=(diff_in_seconds + trs * 0.5) //
        trs * trs)
