Return UTC datetime from timestamp in config file.

        :param section: Config section
        :param option: Config option
        :param fallback: Fallback/default value
        :return: Datetime in UTC
        :rtype: :class:`datetime.datetime`
967802
def get_datetime(self, section, option, fallback):
        
        try:
            s = self[section][option]
            try:
                # If stored as timestamp
                return datetime.utcfromtimestamp(int(s))
            except ValueError:
                # Otherwise parse ISO format
                return datetime.strptime(s, self.DATETIME_FMT)
        except (KeyError, ValueError):
            return fallback
470862
def option(self, option):
        
        if self.__current_section is None:
            raise RuntimeError('No section set in option-getting')
        return self.__config[self.__current_section][option]
730651
def Timestamp():
    
    timestamp = ''
    try:
        timestamp = str(datetime.datetime.now())+' UTC'
    except Exception as e:  # pragma: no cover
        logger.error('Could not get current time ' + str(e))
    return timestamp
567605
def utctimetuple(self):
        ""
        offset = self.utcoffset()
        if offset:
            self -= offset
        y, m, d = self.year, self.month, self.day
        hh, mm, ss = self.hour, self.minute, self.second
        return _build_struct_time(y, m, d, hh, mm, ss, 0)
87102
def _get_config(self, section: str, key: str, fallback: str=object()) -> str:
        
        return self._config.get(section, key, fallback=fallback)
348683
def get_default(self, section, option):
        
        section = self._check_section_option(section, option)
        for sec, options in self.defaults:
            if sec == section:
                if option in options:
                    return options[ option ]
        else:
            return NoDefault
756379
def get(self, section, option, default=NoDefault):
        
        section = self._check_section_option(section, option)

        if not self.has_section(section):
            if default is NoDefault:
                raise cp.NoSectionError(section)
            else:
                self.add_section(section)
        
        if not self.has_option(section, option):
            if default is NoDefault:
                raise cp.NoOptionError(option, section)
            else:
                self.set(section, option, default)
                return default
            
        value = cp.ConfigParser.get(self, section, option, raw=self.raw)
        # Use type of default_value to parse value correctly
        default_value = self.get_default(section, option)
        if isinstance(default_value, bool):
            value = ast.literal_eval(value)
        elif isinstance(default_value, float):
            value = float(value)
        elif isinstance(default_value, int):
            value = int(value)
        elif is_text_string(default_value):
            if PY2:
                try:
                    value = value.decode('utf-8')
                    try:
                        # Some str config values expect to be eval after decoding
                        new_value = ast.literal_eval(value)
                        if is_text_string(new_value):
                            value = new_value
                    except (SyntaxError, ValueError):
                        pass
                except (UnicodeEncodeError, UnicodeDecodeError):
                    pass
        else:
            try:
                # lists, tuples, ...
                value = ast.literal_eval(value)
            except (SyntaxError, ValueError):
                pass
        return value
992058
def last_seen_utc(self) -> Optional[datetime]:
        """"""
        if self._node['seen']:
            return datetime.utcfromtimestamp(self._node['seen'])
888367
def convert_from_utc(timestamp)
      # we know Capistrano release timestamps are UTC, but Ruby doesn't, so make it explicit
      utc_time = timestamp << "UTC" 
      datetime = DateTime.parse(utc_time)
      datetime.new_offset(local_datetime_zone_offset)
    end
15766
def convert_tstamp(response):
	
	if response is None:
		# Allow passing None to convert_tstamp()
		return response

	# Overrides the set timezone to UTC - I think...
	tz = timezone.utc if settings.USE_TZ else None

	return datetime.datetime.fromtimestamp(response, tz)
302160
def get_time_at(time_in=None, time_at=None, out_fmt='%Y-%m-%dT%H:%M:%S'):
    '''
    
    '''
    dt = get_timestamp_at(time_in=time_in, time_at=time_at)
    return time.strftime(out_fmt, time.localtime(dt))
963403
def to_utc(some_time):
    

    # Convert timezone aware objects to UTC
    if some_time.tzinfo and some_time.utcoffset():
        some_time = some_time.astimezone(tzutc())

    # Now that time is UTC, simply remove the timezone component.
    return some_time.replace(tzinfo=None)
1219999
def get_now_utc():
    ''' '''

    # Helper class for UTC time
    # Source: http://stackoverflow.com/questions/2331592/datetime-datetime-utcnow-why-no-tzinfo
    ZERO = datetime.timedelta(0)
    class UTC(datetime.tzinfo):
        """UTC"""
        def utcoffset(self, dt):
            return ZERO
        def tzname(self, dt):
            return "UTC"
        def dst(self, dt):
            return ZERO

    #now = datetime.datetime.now(timezone.utc) # Python 3.2
    now = datetime.datetime.now(UTC())
    return now
454187
def _dtfromtimestamp(timestamp):
    
    try:
        return datetime.datetime.fromtimestamp(timestamp)
    except OSError:
        timestamp -= time.timezone
        dt = datetime.datetime(1970, 1, 1) + datetime.timedelta(seconds=timestamp)
        if _isdst(dt):
            timestamp += 3600
            dt = datetime.datetime(1970, 1, 1) + datetime.timedelta(seconds=timestamp)
        return dt
953810
def adapt_datetimefield_value(self, value):
        
        if value is None:
            return None
        if self.connection._DJANGO_VERSION >= 14 and settings.USE_TZ:
            if timezone.is_aware(value):
                # pyodbc donesn't support datetimeoffset
                value = value.astimezone(timezone.utc)
        if not self.connection.features.supports_microsecond_precision:
            value = value.replace(microsecond=0)
        return value
1307570
def _get_offset_time(utc_offset):
    '''
    
    '''
    if utc_offset is not None:
        minutes = _offset_to_min(utc_offset)
        offset = timedelta(minutes=minutes)
        offset_time = datetime.utcnow() + offset
        offset_time = offset_time.replace(tzinfo=_FixedOffset(minutes))
    else:
        offset_time = datetime.now()
    return offset_time
1221736
def get_modified_time(self) -> Optional[datetime.datetime]:
        
        stat_result = self._stat()
        # NOTE: Historically, this used stat_result[stat.ST_MTIME],
        # which truncates the fractional portion of the timestamp. It
        # was changed from that form to stat_result.st_mtime to
        # satisfy mypy (which disallows the bracket operator), but the
        # latter form returns a float instead of an int. For
        # consistency with the past (and because we have a unit test
        # that relies on this), we truncate the float here, although
        # I'm not sure that's the right thing to do.
        modified = datetime.datetime.utcfromtimestamp(int(stat_result.st_mtime))
        return modified