A method to create a new UDF Timestamp.

        Parameters:
         None.
        Returns:
         Nothing.
356434
def new(self):
        # type: () -> None
        '''
        
        '''
        if self._initialized:
            raise pycdlibexception.PyCdlibInternalError('UDF Timestamp already initialized')

        tm = time.time()
        local = time.localtime(tm)

        self.tz = utils.gmtoffset_from_tm(tm, local)
        # FIXME: for the timetype, 0 is UTC, 1 is local, 2 is 'agreement'.
        # We should let the user set this.
        self.timetype = 1
        self.year = local.tm_year
        self.month = local.tm_mon
        self.day = local.tm_mon
        self.hour = local.tm_hour
        self.minute = local.tm_min
        self.second = local.tm_sec
        self.centiseconds = 0
        self.hundreds_microseconds = 0
        self.microseconds = 0

        self._initialized = True
517940
def creation_time(self):
    """"""
    timestamp = self._fsntfs_file_entry.get_creation_time_as_integer()
    return dfdatetime_filetime.Filetime(timestamp=timestamp)
1022557
def x_build_timestamp( self, node ):
        '''
        
        '''
        self.timestamps.append(self.get_data(node).strip())
        return None
161872
def uuid(value = nil)
      if value.nil?
        timeuuid_generator.now
      elsif value.is_a?(Time)
        timeuuid_generator.at(value)
      elsif value.is_a?(DateTime)
        timeuuid_generator.at(Time.at(value.to_f))
      else
        Type::Timeuuid.instance.cast(value)
      end
    end
878877
def __set_timestamp(self, clock):
        
        if clock is None:
            unix_timestamp = time.mktime(
                datetime.datetime.now().utctimetuple()
            )
            timestamp = int(unix_timestamp)

            return timestamp

        else:
            return clock
162547
def create(self, ttl=values.unset):
        
        data = values.of({'Ttl': ttl, })

        payload = self._version.create(
            'POST',
            self._uri,
            data=data,
        )

        return TokenInstance(self._version, payload, account_sid=self._solution['account_sid'], )
1153119
def udf(f):
    

    @functools.wraps(f)
    def wrapper(*args):
        if any(arg is None for arg in args):
            return None
        return f(*args)

    _SQLITE_UDF_REGISTRY.add(wrapper)
    return wrapper
892137
def get_timestamp(cls, time_string: str, fmt: str):
        
        return int(time.mktime(time.strptime(time_string, fmt)))
293749
def get_formated_creation_date(self, format='%b %Y %d %H:%I:%S'):
        

        if not self._creation_date:
            return None

        date = datetime.datetime.utcfromtimestamp(self._creation_date)
        return date.strftime(format)
591651
def to_timestamp(self, data):
        
        result = pd.Series(index=data.index)
        _slice = ~data[self.col_name].isnull()

        result[_slice] = data[_slice][self.col_name].astype('int64')
        return result
27574
def repr_timestamp(timestamp):
    """"""
    if timestamp is None:
        return 'None'
    dt = datetime_from_timestamp(timestamp)
    ret = "%d (%s)" % (timestamp,
                       dt.strftime('%Y-%m-%d %H:%M:%S.%f %Z'))
    return ret
857386
def fromtimestamp(timestamp):
    
    if timestamp >= 0:
        return datetime.fromtimestamp(timestamp)
    else:
        return datetime(1969, 12, 31, 20, 0) + timedelta(seconds=timestamp)
547834
def to_timestamp(self, value):
        
        if isinstance(value, (six.integer_types, float, six.string_types)):
            try:
                return float(value)
            except ValueError:
                value = self.datetime_str_to_datetime(value)

        if isinstance(value, datetime.datetime):
            return self._datetime_to_timestamp(value)

        if value is None:
            try:
                return float(self.default)
            except:
                return 0.0

        raise exceptions.ValidationError(
            "Unable to convert value: '%s' to timestamp" % value,
            code="invalid_timestamp"
        )
593628
def timestamp_insert(sender, frames):
        
        for frame in frames:
            timestamp = datetime.now(timezone.utc)
            frame.created = timestamp
            frame.modified = timestamp
38193
def from_datetime(self, dt):
        
        global _last_timestamp

        epoch = datetime(1970, 1, 1, tzinfo=dt.tzinfo)
        offset = epoch.tzinfo.utcoffset(epoch).total_seconds() if epoch.tzinfo else 0
        timestamp = (dt  - epoch).total_seconds() - offset

        node = None
        clock_seq = None

        nanoseconds = int(timestamp * 1e9)
        timestamp = int(nanoseconds // 100) + 0x01b21dd213814000

        if clock_seq is None:
            import random
            clock_seq = random.randrange(1 << 14)  # instead of stable storage
        time_low = timestamp & 0xffffffff
        time_mid = (timestamp >> 32) & 0xffff
        time_hi_version = (timestamp >> 48) & 0x0fff
        clock_seq_low = clock_seq & 0xff
        clock_seq_hi_variant = (clock_seq >> 8) & 0x3f
        if node is None:
            node = getnode()
        return pyUUID(fields=(time_low, time_mid, time_hi_version,
                            clock_seq_hi_variant, clock_seq_low, node), version=1)
1144068
def timestamp_to_datetime(response):
    ""
    if not response:
        return None
    try:
        response = int(response)
    except ValueError:
        return None
    return datetime.datetime.fromtimestamp(response)
1223847
def creation_date(self):
        
        timestamp = self._prof.get("timecreated")
        if timestamp:
            return time.localtime(timestamp)