Class: Cassandra::TimestampGenerator::Simple
- Inherits:
-
Object
- Object
- Cassandra::TimestampGenerator::Simple
- Includes:
- Cassandra::TimestampGenerator
- Defined in:
- lib/cassandra/timestamp_generator/simple.rb
Overview
Note:
It is not appropriate for use with JRuby because its Time#now returns millisecond precision time.
Generate long integer timestamps from current time. This implementation relies on the Time class to return microsecond precision time.
Instance Method Summary collapse
-
#next ⇒ Integer
Create a new timestamp, as a 64-bit integer.
Instance Method Details
#next ⇒ Integer
Create a new timestamp, as a 64-bit integer. This is just a wrapper around Time::now.
30 31 32 33 34 35 |
# File 'lib/cassandra/timestamp_generator/simple.rb', line 30 def next # Use Time.now, which has microsecond precision on MRI (and probably Rubinius) to make an int representing # client timestamp in protocol requests. = ::Time.now .tv_sec * 1000000 + .tv_usec end |