Opens a file for tracking the time of the last version check
770027
def timestamp_file():
    """"""
    config_dir = os.path.join(
        os.path.expanduser("~"), BaseGlobalConfig.config_local_dir
    )

    if not os.path.exists(config_dir):
        os.mkdir(config_dir)

    timestamp_file = os.path.join(config_dir, "cumulus_timestamp")

    try:
        with open(timestamp_file, "r+") as f:
            yield f
    except IOError:  # file does not exist
        with open(timestamp_file, "w+") as f:
            yield f
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();
    }
  }
1098283
def file_uptodate(fname, cmp_fname):
    
    try:
        return (file_exists(fname) and file_exists(cmp_fname) and
                os.path.getmtime(fname) >= os.path.getmtime(cmp_fname))
    except OSError:
        return False
719718
def check(self, final_line_count):
        """"""
        if self._lines_seen["version"]:
            self._process_version_lines()
        self._process_plan_lines(final_line_count)
55363
def timestamp
      if File.exist?(name)
        File.mtime(name.to_s)
      else
        Rake::EARLY
      end
    end
1309070
def is_outdated(self):
        """"""
        if self.args.disable_check_update:
            # Check is disabled by configuration
            return False

        logger.debug("Check Glances version (installed: {} / latest: {})".format(self.installed_version(), self.latest_version()))
        return LooseVersion(self.latest_version()) > LooseVersion(self.installed_version())
1191246
def last(conf):
    """"""
    try:
        v2ex = V2ex(conf.config)
        v2ex.login()
        last_date = v2ex.get_last()
        click.echo(last_date)
    except KeyError:
        click.echo('Keyerror, please check your config file.')
    except IndexError:
        click.echo('Please check your username and password.')
1034818
def read_version():
    """"""
    finder = VersionFinder()
    finder.visit(ast.parse(local_file('curdling', 'version.py')))
    return finder.version
50217
public String calculateVersionFrom(@NotNull File file){
        Objects.requireNonNull(file, "file argument cannot be null");
        //optimise by store hash against file modified time, on subsequent calls, check file modified time first to determine file and time is present and return previous data.
        final long lastModified = file.lastModified();
        final String key = file.getAbsolutePath() + lastModified;
        final String storedHashValue = fixedSizeCache.get(key);
        if(!StringUtils.isEmpty(storedHashValue)){
            return storedHashValue;
        }
        final String digestHex;
        try {
            digestHex = getHashFromBytes(Files.readAllBytes(file.toPath()));
        } catch (IOException e) {
            throw new IllegalStateException(e);
        }
        fixedSizeCache.put(key, digestHex);
        return digestHex;
    }
292209
def get_last_version(skip_tags=None) -> Optional[str]:
    

    debug('get_last_version skip_tags=', skip_tags)
    check_repo()
    skip_tags = skip_tags or []

    def version_finder(tag):
        if isinstance(tag.commit, TagObject):
            return tag.tag.tagged_date
        return tag.commit.committed_date

    for i in sorted(repo.tags, reverse=True, key=version_finder):
        if re.match(r'v\d+\.\d+\.\d+', i.name):
            if i.name in skip_tags:
                continue
            return i.name[1:]
    return None
504818
def read_version():
    
    regex = re.compile('^(?P<number>\d.*?) .*$')

    with open('../CHANGELOG.rst') as f:
        for line in f:
            match = regex.match(line)
            if match:
                return match.group('number')
848250
def get_current_release(self):
        
        current = self._runner.run("readlink '{0}'".format(self._current))
        if current.failed:
            return None
        return os.path.basename(current.strip())
1095876
def get_days_since_last_modified(filename):
        
        now = datetime.now()
        last_modified = datetime.fromtimestamp(os.path.getmtime(filename))
        return (now - last_modified).days
1055639
def my_version():
    """"""
    if os.path.exists(resource_filename(__name__, 'version')):
        return resource_string(__name__, 'version')

    return open(os.path.join(os.path.dirname(__file__),
                             "..", "version")).read()
43566
public function lastUpdatedDate() {
    $directory = $this->environment->getHooksDirectory();
    $hooks_file = "$directory/hooks_processed.php";
    if (file_exists($hooks_file)) {
      $timestamp = filemtime($hooks_file);
      return $timestamp;
    }
  }
151175
def time_restarts(data_path):
    
    path = os.path.join(data_path, 'last_restarted')
    if not os.path.isfile(path):
        with open(path, 'a'):
            os.utime(path, None)

    last_modified = os.stat(path).st_mtime

    with open(path, 'a'):
        os.utime(path, None)

    now = os.stat(path).st_mtime
    dif = round(now - last_modified, 2)
    last_restart = datetime.fromtimestamp(now).strftime('%H:%M:%S')
    result = 'LAST RESTART WAS {} SECONDS AGO at {}'.format(dif, last_restart)
    print(style(fg='green', bg='red', text=result))
1012624
def getTimeSinceLastUpdate(IOType):
    """"""
    global last_update_times
    # assert(IOType in ['net', 'disk', 'process_disk'])
    current_time = time()
    last_time = last_update_times.get(IOType)
    if not last_time:
        time_since_update = 1
    else:
        time_since_update = current_time - last_time
    last_update_times[IOType] = current_time
    return time_since_update