Class: Nagoriyuki::Generators::Msec

Inherits:
Base
  • Object
show all
Defined in:
lib/nagoriyuki/generators/msec.rb

Defined Under Namespace

Classes: InvalidSystemClock

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#initialize, #length, #name

Constructor Details

This class inherits a constructor from Nagoriyuki::Generators::Base

Instance Method Details

#biggest(timestamp) ⇒ Object



24
25
26
# File 'lib/nagoriyuki/generators/msec.rb', line 24

def biggest(timestamp)
  ((timestamp.to_s + "999").to_i - offset_epoch) & bit_fill
end

#generateObject Also known as: current



10
11
12
# File 'lib/nagoriyuki/generators/msec.rb', line 10

def generate
  subtract & bit_fill
end

#offset_epochObject



16
17
18
# File 'lib/nagoriyuki/generators/msec.rb', line 16

def offset_epoch
  options["offset_epoch"]
end

#smallest(timestamp) ⇒ Object



20
21
22
# File 'lib/nagoriyuki/generators/msec.rb', line 20

def smallest(timestamp)
  ((timestamp.to_s + "000").to_i - offset_epoch) & bit_fill
end