class Cassandra::TimestampGenerator::Simple
Generate long integer timestamps from current time. This implementation relies on the {::Time} class to return microsecond precision time. @note It is not appropriate for use with JRuby because its {::Time#now} returns millisecond precision time.
Public Instance Methods
next()
click to toggle source
Create a new timestamp, as a 64-bit integer. This is just a wrapper around Time::now.
@return [Integer] an integer representing a timestamp in microseconds.
# File lib/cassandra/timestamp_generator/simple.rb 30 def next 31 # Use Time.now, which has microsecond precision on MRI (and probably Rubinius) to make an int representing 32 # client timestamp in protocol requests. 33 timestamp = ::Time.now 34 timestamp.tv_sec * 1000000 + timestamp.tv_usec 35 end