Last active
December 16, 2015 06:39
-
-
Save headius/5393552 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/org/jruby/RubyTime.java b/src/org/jruby/RubyTime.java | |
index d41a491..57f7f3c 100644 | |
--- a/src/org/jruby/RubyTime.java | |
+++ b/src/org/jruby/RubyTime.java | |
@@ -1102,6 +1102,16 @@ public class RubyTime extends RubyObject { | |
public static RubyTime load(IRubyObject recv, IRubyObject from, Block block) { | |
return s_mload(recv, (RubyTime)(((RubyClass)recv).allocate()), from); | |
} | |
+ | |
+ @JRubyMethod(name = {"timestamp", "current_timestamp"}, meta = true) | |
+ public static IRubyObject timestamp(ThreadContext context) { | |
+ return context.runtime.newFixnum(System.currentTimeMillis() / 1000); | |
+ } | |
+ | |
+ @JRubyMethod(meta = true) | |
+ public static IRubyObject microtime(ThreadContext context) { | |
+ return context.runtime.newFloat(System.currentTimeMillis() / 1000.0); | |
+ } | |
@Override | |
public Object toJava(Class target) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment