Timestamp when the story has last been watched or None (local time zone).
346542
def last_seen_local(self) -> Optional[datetime]:
        """"""
        if self._node['seen']:
            return datetime.fromtimestamp(self._node['seen'])
645390
def start_timestamp(self):
    """"""
    if self.event_timestamp:
      return self.event_timestamp - (
          self.duration * self._MICRO_SECONDS_PER_MINUTE)

    return None
1359058
def timestamp(x):
    """"""
    if x.tzinfo is None:
        # Naive dates to utc
        x = x.replace(tzinfo=utc)

    if hasattr(x, 'timestamp'):
        return x.timestamp()
    else:
        return (x - datetime(1970, 1, 1, tzinfo=utc)).total_seconds()
772525
def check_if_modified_since(self, dt, etag=None):
        """"""
        dt = dt.replace(microsecond=0)
        if request.if_modified_since and dt <= request.if_modified_since:
            raise SameContentException(etag, last_modified=dt)
823977
def last_video(self):
        """"""
        if self._cached_videos is None:
            self.make_video_cache()

        if self._cached_videos:
            return self._cached_videos[0]
        return None
1088772
def _past_datetime_from(self):
        
        prevDt = self.__localBefore(timezone.localtime(), dt.time.max,
                                    excludeCancellations=True,
                                    excludeExtraInfo=True)
        return prevDt
189618
def timestamp(self, value):
        
        if not self._timestamp_is_valid(value):
            value = self._calculate_current_timestamp()
        self._timestamp = value
763310
def _print_if_needed(self):
        """"""
        if self._in_txn or self.print_frequency is None:
            return
        elif self.last_export is not None and \
             self.last_export + self.print_frequency > time.time():
            return

        self.export()
761045
def archive_if_exists(filename):
    
    if os.path.exists(filename):
        current_time = datetime.datetime.now()
        dt_format = '%Y-%m-%dT%H:%M:%S%z'
        timestamp = current_time.strftime(dt_format)
        dst = filename + '_' + timestamp
        shutil.move(filename, dst)
674166
def watch_one_event(event_filter, callback, timeout_callback, timeout, args,
                        start_time=None):
        
        if timeout and not start_time:
            start_time = int(datetime.now().timestamp())

        if not args:
            args = []

        while True:
            try:
                events = event_filter.get_all_entries()
                if events:
                    callback(events[0], *args)
                    return

            except (ValueError, Exception) as err:
                # ignore error, but log it
                logger.debug(f'Got error grabbing keeper events: {str(err)}')

            time.sleep(0.1)
            if timeout:
                elapsed = int(datetime.now().timestamp()) - start_time
                if elapsed > timeout:
                    if timeout_callback:
                        timeout_callback(*args)
                    else:
                        callback(None, *args)
                    break
992058
def last_seen_utc(self) -> Optional[datetime]:
        """"""
        if self._node['seen']:
            return datetime.utcfromtimestamp(self._node['seen'])
598718
def timestamp
      if File.exist?(name)
        File.mtime(name.to_s)
      else
        Rake::LATE
      end
    end
670195
def set_timestamps
        if self.errors.empty?
          self.created_at = DateTime.now.utc if self.respond_to?(:created_at=) && self.created_at.nil?
          self.updated_at = DateTime.now.utc if self.respond_to?(:updated_at=)
        end
      end
757933
def from_timestamp(timestamp, tz_offset):
    """"""
    utc_dt = datetime.fromtimestamp(timestamp, utc)
    try:
        local_dt = utc_dt.astimezone(tzoffset(tz_offset))
        return local_dt
    except ValueError:
        return utc_dt
280081
def inactive_time(self):
        
        if self._inactive_event.is_set():
            return self.pin_factory.ticks_diff(self.pin_factory.ticks(),
                                               self._last_changed)
        else:
            return None
399039
def _set_timestamps_on_attach(self, record, exists=False):
        
        fresh = self._parent.fresh_timestamp()

        if not exists and self._has_pivot_column(self.created_at()):
            record[self.created_at()] = fresh

        if self._has_pivot_column(self.updated_at()):
            record[self.updated_at()] = fresh

        return record
315457
def _get_timestamp(self):
        """"""
        filename_date = _find_date(os.path.basename(self._path))
        if filename_date:
            return filename_date