Class: Time

Inherits:
Object
  • Object
show all
Defined in:
lib/timestamp.rb

Constant Summary collapse

@@timestamp =
Java::Default::Timestamp.new.tap{|ts| ts.java_send :basicLoad, [org.jruby.Ruby], org.jruby.Ruby.getGlobalRuntime }

Class Method Summary collapse

Class Method Details

.timestampInteger

Returns a nanosecond timestamp on the system’s monotonic clock.

Time.timestamp  #=> 17817203921822

Returns:

  • (Integer)


33
34
35
# File 'ext/timestamp/Timestamp.c', line 33

def timestamp
  @@timestamp.java_send :timestamp, []
end

.unix_microtimeFloat

Returns the current time as a floating-point number of seconds since the Epoch.

Time.unix_microtime  #=> 1363352771.315240

Returns:

  • (Float)


83
84
85
# File 'ext/timestamp/Timestamp.c', line 83

def unix_microtime
  @@timestamp.java_send :unix_microtime, []
end

.unix_timestampInteger .unix_timeInteger Also known as: unix_time

Returns the current time as an integer number of seconds since the Epoch.

Time.unix_timestamp  #=> 1363352771
Time.unix_time       #=> 1363352771

Overloads:

  • .unix_timestampInteger

    Returns:

    • (Integer)
  • .unix_timeInteger

    Returns:

    • (Integer)


67
68
69
# File 'ext/timestamp/Timestamp.c', line 67

def unix_timestamp
  @@timestamp.java_send :unix_timestamp, []
end