'Display time in SR format
TODO: Rename this to srftime
:param dt: datetime object
:param show_seconds: Boolean, show seconds
:param t_preset: Preset time format
:return: time string'

@static_or_instance
def srftime(self, dt=None, show_seconds=False, t_preset=None):

    try:
        locale.setlocale(locale.LC_TIME, u'')
    except Exception:
        pass
    try:
        if srDateTime.has_locale:
            locale.setlocale(locale.LC_TIME, u'en_US')
    except Exception:
        try:
            if srDateTime.has_locale:
                locale.setlocale(locale.LC_TIME, srDateTime.en_US_norm)
        except Exception:
            srDateTime.has_locale = False
    strt = u''
    try:
        if (self is None):
            if (dt is not None):
                if (t_preset is not None):
                    strt = dt.strftime(t_preset)
                elif show_seconds:
                    strt = dt.strftime(sickrage.srCore.srConfig.TIME_PRESET_W_SECONDS)
                else:
                    strt = dt.strftime(sickrage.srCore.srConfig.TIME_PRESET)
        elif (t_preset is not None):
            strt = self.strftime(t_preset)
        elif show_seconds:
            strt = self.strftime(sickrage.srCore.srConfig.TIME_PRESET_W_SECONDS)
        else:
            strt = self.strftime(sickrage.srCore.srConfig.TIME_PRESET)
    finally:
        try:
            if srDateTime.has_locale:
                locale.setlocale(locale.LC_TIME, u'')
        except Exception:
            srDateTime.has_locale = False
    return strt
