Adds the file's modified time into its internal watchlist.
170380
def _watch_file(self, filepath, trigger_event=True):
        """"""
        is_new = filepath not in self._watched_files
        if trigger_event:
            if is_new:
                self.trigger_created(filepath)
            else:
                self.trigger_modified(filepath)
        try:
            self._watched_files[filepath] = self._get_modified_time(filepath)
        except OSError:
            return
1078472
def add_time(self, extra_time):
        """"""
        window_start = self.parent.value('window_start') + extra_time
        self.parent.overview.update_position(window_start)
1050199
function addMtime(err, stats) {
      if (err) {
        // Skip elements of `files` that don't point to existing files.
        // This can happen if some other Metalsmith plugin does something
        // strange with `files`.
        if (err.code === 'ENOENT') {
          debug('file %s not found', file);
          return done();
        }
        return done(err);
      }

      debug('mtime of file %s is %s', file, stats.mtime);
      files[file].mtime = stats.mtime;
      done();
    }
908419
function onFile(filePath, stat) {
      if (filePath.match(ignore) || filePath.match(globalIgnore)) { return; }
      var newTimestamp = updateTimestamp(stat.mtime);
      if (manifest['CACHE'].insert(toUrl(cleanPath(filePath))) || newTimestamp) {
        updateListener(manifest);
      }
    }
62610
def _start_monitoring(self):
        
        
        # Grab all the timestamp info
        before = self._file_timestamp_info(self.path)

        while True:
            gevent.sleep(1)
            after = self._file_timestamp_info(self.path)

            added = [fname for fname in after.keys() if fname not in before.keys()]
            removed = [fname for fname in before.keys() if fname not in after.keys()]
            modified = []

            for fname in before.keys():
                if fname not in removed:
                    if os.path.getmtime(fname) != before.get(fname):
                        modified.append(fname)

            if added: 
                self.on_create(added)
            if removed: 
                self.on_delete(removed)
            if modified: 
                self.on_modify(modified)
    
            before = after
1200245
def change_time(filename, newtime):
    """"""
    with open(filename, "w") as faketimetxt_handle:
        faketimetxt_handle.write("@" + newtime.strftime("%Y-%m-%d %H:%M:%S"))
492917
def change_time(self):
    """"""
    timestamp = self._fsntfs_file_entry.get_entry_modification_time_as_integer()
    return dfdatetime_filetime.Filetime(timestamp=timestamp)
490307
function getAddMtime(file, done) {
    fs.stat(path.join(source, file), addMtime);


    /**
     * Adds `stats.mtime` of `file` to its metadata.
     *
     * @param {Error} err
     * @param {fs.Stats} stats
     * @api private
     */

    function addMtime(err, stats) {
      if (err) {
        // Skip elements of `files` that don't point to existing files.
        // This can happen if some other Metalsmith plugin does something
        // strange with `files`.
        if (err.code === 'ENOENT') {
          debug('file %s not found', file);
          return done();
        }
        return done(err);
      }

      debug('mtime of file %s is %s', file, stats.mtime);
      files[file].mtime = stats.mtime;
      done();
    }
  }
824013
public function modifyFile()
    {
        foreach (['chown', 'chgrp', 'chmod'] as $key) {
            $value = $this->{$key};
            if ($value) {
                $this->file->{$key}($value);
            }
        }
    }
1064015
def addWatchedDirectory(self, dirname, watching=Purr.WATCHED, save_config=True):
        """"""
        # see if we're alredy watching this exact set of directories -- do nothing if so
        dirname = Purr.canonizePath(dirname)
        # do nothing if already watching
        if dirname in self.watched_dirs:
            dprint(1, "addWatchDirectory(): already watching %s\n", dirname)
            # watching=None means do not change the watch-state
            if watching is None:
                return
        else:
            if watching is None:
                watching = Purr.WATCHED
            # make watcher object
            wdir = Purrer.WatchedDir(dirname, mtime=self.timestamp,
                                     watch_patterns=self._watch_patterns, ignore_patterns=self._ignore_patterns)
            # fileset=None indicates error reading directory, so ignore it
            if wdir.fileset is None:
                print("There was an error reading the directory %s, will stop watching it." % dirname)
                self.setWatchingState(dirname, Purr.REMOVED, save_config=True)
                return
            self.watchers[dirname] = wdir
            self.watched_dirs.append(dirname)
            dprintf(2, "watching directory %s, mtime %s, %d files\n",
                    dirname, time.strftime("%x %X", time.localtime(wdir.mtime)), len(wdir.fileset))
            # find files in this directory matching the watch_patterns, and watch them for changes
            watchset = set()
            for patt in self._watch_patterns:
                watchset.update(fnmatch.filter(wdir.fileset, patt))
            for fname in watchset:
                quiet = matches_patterns(fname, self._quiet_patterns)
                fullname = Purr.canonizePath(os.path.join(dirname, fname))
                if fullname not in self.watchers:
                    wfile = Purrer.WatchedFile(fullname, quiet=quiet, mtime=self.timestamp)
                    self.watchers[fullname] = wfile
                    dprintf(3, "watching file %s, timestamp %s, quiet %d\n",
                            fullname, time.strftime("%x %X", time.localtime(wfile.mtime)), quiet)
            # find subdirectories  matching the subdir_patterns, and watch them for changes
            for fname in wdir.fileset:
                fullname = Purr.canonizePath(os.path.join(dirname, fname))
                if os.path.isdir(fullname):
                    for desc, dir_patts, canary_patts in self._subdir_patterns:
                        if matches_patterns(fname, dir_patts):
                            quiet = matches_patterns(fname, self._quiet_patterns)
                            wdir = Purrer.WatchedSubdir(fullname, canary_patterns=canary_patts, quiet=quiet,
                                                        mtime=self.timestamp)
                            self.watchers[fullname] = wdir
                            dprintf(3, "watching subdirectory %s/{%s}, timestamp %s, quiet %d\n",
                                    fullname, ",".join(canary_patts),
                                    time.strftime("%x %X", time.localtime(wdir.mtime)), quiet)
                            break
        # set state and save config
        self.setWatchingState(dirname, watching, save_config=save_config)
383541
@Deprecated
    public void addWatcher(File file, Watcher watcher) {
        addWatcher(file.toPath(), watcher);
    }
917739
def __watch_file_system(self):
        

        for path, data in self.__paths.items():
            stored_modified_time, is_file = data
            try:
                if not foundations.common.path_exists(path):
                    LOGGER.warning(
                        "!> {0} | '{1}' path has been invalidated and will be unregistered!".format(
                            self.__class__.__name__, path))
                    del (self.__paths[path])
                    if is_file:
                        self.file_invalidated.emit(path)
                    else:
                        self.directory_invalidated.emit(path)
                    continue
            except KeyError:
                LOGGER.debug("> {0} | '{1}' path has been unregistered while iterating!".format(
                    self.__class__.__name__, path))
                continue

            try:
                modified_time = self.get_path_modified_time(path)
            except OSError:
                LOGGER.debug("> {0} | '{1}' path has been invalidated while iterating!".format(
                    self.__class__.__name__, path))
                continue

            if stored_modified_time != modified_time:
                self.__paths[path] = (modified_time, os.path.isfile(path))
                LOGGER.debug("> {0} | '{1}' path has been changed!".format(self.__class__.__name__, path))
                if is_file:
                    self.file_changed.emit(path)
                else:
                    self.directory_changed.emit(path)
1248678
def set_timestamp(cls, filename: str, response: HTTPResponse):
        '''
        '''
        last_modified = response.fields.get('Last-Modified')

        if not last_modified:
            return

        try:
            last_modified = email.utils.parsedate(last_modified)
        except ValueError:
            _logger.exception('Failed to parse date.')
            return

        last_modified = time.mktime(last_modified)

        os.utime(filename, (time.time(), last_modified))
1303441
def file_created_date
      assert_exists
      web_response = @object.getWebResponse(true)
      Time.parse(web_response.getResponseHeaderValue("Last-Modified").to_s)
    end
602846
function addWatcher(dirPath) {
    Debug._l(dirPath);
    /*fs.watchFile(dirPath, function (curr, prev) {
     //        console.log('the current mtime is: ' + curr.mtime);
     //        console.log('the previous mtime was: ' + prev.mtime);

     generateCache(id, dirPath);
     });*/
    var watch = Watcher(dirPath, function (filePath, isModified, isDeleted) {
        if (isModified) {
            Debug._l(generateIdFromFilePath(filePath));
            generateCache(filePath);
        }
        if (isDeleted) {
            removeCache(generateIdFromFilePath(filePath));
        }
    });

    return watch;
}
675884
def _is_modified(self, filepath):
        
        if self._is_new(filepath):
            return False
        mtime = self._get_modified_time(filepath)
        return self._watched_files[filepath] < mtime
1360576
def date_added(self, date_added):
        """"""
        self._indicator_data['dateAdded'] = self._utils.format_datetime(
            date_added, date_format='%Y-%m-%dT%H:%M:%SZ'
        )