Module: Sequel::Dataset::RoundTimestamps

Defined in:
lib/sequel/extensions/round_timestamps.rb

Instance Method Summary collapse

Instance Method Details

#literal_datetime(v) ⇒ Object

Round DateTime values before literalizing



35
36
37
# File 'lib/sequel/extensions/round_timestamps.rb', line 35

def literal_datetime(v)
  super(v + Rational(5, 10**timestamp_precision)/864000)
end

#literal_sqltime(v) ⇒ Object

Round Sequel::SQLTime values before literalizing



40
41
42
# File 'lib/sequel/extensions/round_timestamps.rb', line 40

def literal_sqltime(v)
  super(v.round(timestamp_precision))
end

#literal_time(v) ⇒ Object

Round Time values before literalizing



45
46
47
# File 'lib/sequel/extensions/round_timestamps.rb', line 45

def literal_time(v)
  super(v.round(timestamp_precision))
end