Sync most recent file by date, time attribues
320125
def up_by_time(*filters, local_dir=".", remote_dir=DEFAULT_REMOTE_DIR, count=1):
    """"""
    remote_files = command.map_files_raw(remote_dir=remote_dir)
    local_files = list_local_files(*filters, local_dir=local_dir)
    most_recent = sorted(local_files, key=lambda f: f.datetime)
    to_sync = most_recent[-count:]
    _notify_sync(Direction.up, to_sync)
    up_by_files(to_sync[::-1], remote_dir, remote_files)
291902
def sync(self):
        ''
        log.info("syncing %r" % self.path)
        self.folder = self.jfs.get(self.path)
        self.synced = True
1364710
protected function synchronize()
	{
		if( file_exists( $this->syncFile ) )
		{
			$time	= filemtime( $this->syncFile );
			if( ( time() - $time ) < $this->refreshTime )
			{
				$this->syncTime	= $time;
				$this->syncDiff	= FS_File_Reader::load( $this->syncFile );
				return;
			}
		}
		$this->syncTime	= time();
		$this->syncDiff	= $this->syncTime - Net_AtomTime::getTimestamp();
		FS_File_Writer::save( $this->syncFile, $this->syncDiff );
		touch( $this->syncFile );
	}
480289
def sync_in_files(self, force=False):
        """"""
        self.log('---- Sync Files ----')

        self.dstate = self.STATES.BUILDING

        for f in self.build_source_files:

            if self.source_fs.exists(f.record.path):
                # print f.path, f.fs_modtime, f.record.modified, f.record.source_hash, f.fs_hash
                if f.fs_is_newer or force:
                    self.log('Sync: {}'.format(f.record.path))
                    f.fs_to_record()

        self.commit()
30478
def track_update(self):
        """"""
        metadata = self.info()
        metadata.updated_at = dt.datetime.now()
        self.commit()
673367
def __set_recent_files_actions(self):
        

        recentFiles = [foundations.strings.to_string(file)
                       for file in self.__settings.get_key(self.__settings_section, "recentFiles").toStringList()
                       if foundations.common.path_exists(file)]
        if not recentFiles:
            return

        numberRecentFiles = min(len(recentFiles), self.__maximum_recent_files)

        for i in range(self.__maximum_recent_files):
            if i >= numberRecentFiles:
                self.__recent_files_actions[i].setVisible(False)
                continue

            LOGGER.debug("> Adding '{0}' file to recent files actions.".format(recentFiles[i]))

            self.__recent_files_actions[i].setText("{0} {1}".format(i + 1, os.path.basename(
                foundations.strings.to_string(recentFiles[i]))))
            self.__recent_files_actions[i].data = foundations.strings.to_string(recentFiles[i])
            self.__recent_files_actions[i].setVisible(True)
55363
def timestamp
      if File.exist?(name)
        File.mtime(name.to_s)
      else
        Rake::EARLY
      end
    end
996429
def sync_out(self, file_name=None, force=False):
        """"""
        self.log('---- Sync Out ----')
        from ambry.bundle.files import BuildSourceFile

        self.dstate = self.STATES.BUILDING

        for f in self.build_source_files.list_records():

            if (f.sync_dir() == BuildSourceFile.SYNC_DIR.RECORD_TO_FILE or f.record.path == file_name) or force:
                self.log('Sync: {}'.format(f.record.path))
                f.record_to_fs()

        self.commit()
1359082
def sync_time(self):
        """"""
        now = time.localtime(time.time())
        self.remote(set_time, (now.tm_year, now.tm_mon, now.tm_mday, now.tm_wday + 1,
                               now.tm_hour, now.tm_min, now.tm_sec, 0))
        return now
401011
def _update(self):
        """"""
        update = not self._reminders

        with self._lock:
            for fname in self._reminders:
                if getmtime(fname) > self._mtime:
                    update = True
                    break

            if update:
                self._reminders = self._parse_remind(self._filename)
893132
def set_recent_files(self, recent_files):
        """"""
        for recent_file in recent_files[:]:
            if not os.path.isfile(recent_file):
                recent_files.remove(recent_file)
        try:
            self.CONF[WORKSPACE].set('main', 'recent_files',
                                     list(OrderedDict.fromkeys(recent_files)))
        except EnvironmentError:
            pass
598718
def timestamp
      if File.exist?(name)
        File.mtime(name.to_s)
      else
        Rake::LATE
      end
    end
1203291
def add_time(data):
    
    payload = data['data']
    updated = data['updated'].date()
    if updated == date.today():
        payload['last_updated'] = data['updated'].strftime('today at %H:%M:%S')
    elif updated >= (date.today() - timedelta(days=1)):
        payload['last_updated'] = 'yesterday'
    elif updated >= (date.today() - timedelta(days=7)):
        payload['last_updated'] = updated.strftime('on %A')
    else:
        payload['last_updated'] = updated.strftime('%Y-%m-%d')
    return payload
680462
protected void applyTimestamps(ContentStream content, File localFile) {
        FileTime createTime =
            convertDateToFileTime(content.getDateCreated());
        FileTime lastAccessTime =
            convertDateToFileTime(content.getDateLastAccessed());
        FileTime lastModTime =
            convertDateToFileTime(content.getDateLastModified());

        BasicFileAttributeView fileAttributeView =
            Files.getFileAttributeView(localFile.toPath(),
                                       BasicFileAttributeView.class,
                                       LinkOption.NOFOLLOW_LINKS);
        // If any time value is null, that value is left unchanged
        try {
            fileAttributeView.setTimes(lastModTime, lastAccessTime, createTime);
        } catch (IOException e) {
            logger.error("Error setting timestamps for local file " +
                         localFile.getAbsolutePath() + ": " + e.getMessage(),
                         e);
        }
    }
1149873
def _sync_io(self):
        """"""
        if self._file_epoch == self.file_object.epoch:
            return

        if self._io.binary:
            contents = self.file_object.byte_contents
        else:
            contents = self.file_object.contents

        self._set_stream_contents(contents)
        self._file_epoch = self.file_object.epoch
375964
def get_timestamps(cols, created_name, updated_name):
  """"""
  has_created = created_name in cols
  has_updated = updated_name in cols
  return (created_name if has_created else None, updated_name if has_updated else None)
477306
def touch(filename, timestamp):
    """"""
    if timestamp is not None:
        timestamp = (timestamp, timestamp)  # atime, mtime

    from os import utime
    utime(filename, timestamp)