public IRubyObject mtimeLessThan(IRubyObject other) { FileStat otherStat = newFileStat(getRuntime(), other.convertToString().toString(), false).stat; boolean lt; if (stat instanceof NanosecondFileStat && otherStat instanceof NanosecondFileStat) { lt = (stat.mtime() * BILLION + ((NanosecondFileStat) stat).mTimeNanoSecs()) < (otherStat.mtime() * BILLION + ((NanosecondFileStat) otherStat).mTimeNanoSecs()); } else { lt = stat.mtime() < otherStat.mtime(); } return getRuntime().newBoolean(lt); }
public IRubyObject mtimeLessThan(IRubyObject other) { FileStat otherStat = newFileStat(getRuntime(), other.convertToString().toString(), false).stat; boolean lt; if (stat instanceof NanosecondFileStat && otherStat instanceof NanosecondFileStat) { lt = (stat.mtime() * BILLION + ((NanosecondFileStat) stat).mTimeNanoSecs()) < (otherStat.mtime() * BILLION + ((NanosecondFileStat) otherStat).mTimeNanoSecs()); } else { lt = stat.mtime() < otherStat.mtime(); } return getRuntime().newBoolean(lt); }
public IRubyObject mtimeGreaterThan(IRubyObject other) { FileStat otherStat = newFileStat(getRuntime(), other.convertToString().toString(), false).stat; boolean gt; if (stat instanceof NanosecondFileStat && otherStat instanceof NanosecondFileStat) { gt = (stat.mtime() * BILLION + ((NanosecondFileStat) stat).mTimeNanoSecs()) > (otherStat.mtime() * BILLION + ((NanosecondFileStat) otherStat).mTimeNanoSecs()); } else { gt = stat.mtime() > otherStat.mtime(); } return getRuntime().newBoolean(gt); }
public IRubyObject mtimeGreaterThan(IRubyObject other) { FileStat otherStat = newFileStat(getRuntime(), other.convertToString().toString(), false).stat; boolean gt; if (stat instanceof NanosecondFileStat && otherStat instanceof NanosecondFileStat) { gt = (stat.mtime() * BILLION + ((NanosecondFileStat) stat).mTimeNanoSecs()) > (otherStat.mtime() * BILLION + ((NanosecondFileStat) otherStat).mTimeNanoSecs()); } else { gt = stat.mtime() > otherStat.mtime(); } return getRuntime().newBoolean(gt); }
@JRubyMethod(name = "mtime") public IRubyObject mtime() { return getRuntime().newTime(stat.mtime() * 1000); }
@JRubyMethod(name = "mtime") public IRubyObject mtime() { return getRuntime().newTime(stat.mtime() * 1000); }
public IRubyObject mtimeEquals(IRubyObject other) { FileStat otherStat = newFileStat(getRuntime(), other.convertToString().toString(), false).stat; boolean equal = stat.mtime() == otherStat.mtime(); if (stat instanceof NanosecondFileStat && otherStat instanceof NanosecondFileStat) { equal = equal && ((NanosecondFileStat) stat).mTimeNanoSecs() == ((NanosecondFileStat) otherStat).mTimeNanoSecs(); } return getRuntime().newBoolean(equal); }
public IRubyObject mtimeEquals(IRubyObject other) { FileStat otherStat = newFileStat(getRuntime(), other.convertToString().toString(), false).stat; boolean equal = stat.mtime() == otherStat.mtime(); if (stat instanceof NanosecondFileStat && otherStat instanceof NanosecondFileStat) { equal = equal && ((NanosecondFileStat) stat).mTimeNanoSecs() == ((NanosecondFileStat) otherStat).mTimeNanoSecs(); } return getRuntime().newBoolean(equal); }
@JRubyMethod(name = "<=>", required = 1) public IRubyObject cmp(IRubyObject other) { if (!(other instanceof RubyFileStat)) return getRuntime().getNil(); long time1 = stat.mtime(); long time2 = ((RubyFileStat) other).stat.mtime(); if (time1 == time2) { return getRuntime().newFixnum(0); } else if (time1 < time2) { return getRuntime().newFixnum(-1); } return getRuntime().newFixnum(1); }
@JRubyMethod(name = "<=>", required = 1) public IRubyObject cmp(IRubyObject other) { if (!(other instanceof RubyFileStat)) return getRuntime().getNil(); long time1 = stat.mtime(); long time2 = ((RubyFileStat) other).stat.mtime(); if (time1 == time2) { return getRuntime().newFixnum(0); } else if (time1 < time2) { return getRuntime().newFixnum(-1); } return getRuntime().newFixnum(1); }
@JRubyMethod(name = "<=>", required = 1) public IRubyObject cmp(IRubyObject other) { checkInitialized(); if (!(other instanceof RubyFileStat)) return getRuntime().getNil(); long time1 = stat.mtime(); long time2 = ((RubyFileStat) other).stat.mtime(); if (time1 == time2) { return getRuntime().newFixnum(0); } else if (time1 < time2) { return getRuntime().newFixnum(-1); } return getRuntime().newFixnum(1); }
@JRubyMethod(name = "<=>", required = 1) public IRubyObject cmp(IRubyObject other) { checkInitialized(); if (!(other instanceof RubyFileStat)) return getRuntime().getNil(); long time1 = stat.mtime(); long time2 = ((RubyFileStat) other).stat.mtime(); if (time1 == time2) { return getRuntime().newFixnum(0); } else if (time1 < time2) { return getRuntime().newFixnum(-1); } return getRuntime().newFixnum(1); }
public static PyStatResult fromFileStat(FileStat stat) { return new PyStatResult( Py.newInteger(stat.mode()), Py.newInteger(stat.ino()), Py.newLong(stat.dev()), Py.newInteger(stat.nlink()), Py.newInteger(stat.uid()), Py.newInteger(stat.gid()), Py.newInteger(stat.st_size()), Py.newFloat(stat.atime()), Py.newFloat(stat.mtime()), Py.newFloat(stat.ctime())); }