Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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
Something went wrong with that request. Please try again.