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



38
39
40
# File 'lib/sequel/extensions/round_timestamps.rb', line 38

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

#literal_sqltime(v) ⇒ Object

Round Sequel::SQLTime values before literalizing



43
44
45
# File 'lib/sequel/extensions/round_timestamps.rb', line 43

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

#literal_time(v) ⇒ Object

Round Time values before literalizing



48
49
50
# File 'lib/sequel/extensions/round_timestamps.rb', line 48

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