Module: LIFX::LAN::Seen

Included in:
Light
Defined in:
lib/lifx/lan/seen.rb

Instance Method Summary collapse

Instance Method Details

#last_seenTime

Returns the time when the device was last seen.

Returns:

  • (Time)


6
7
8
# File 'lib/lifx/lan/seen.rb', line 6

def last_seen
  @last_seen
end

#seconds_since_seenFloat

Returns the number of seconds since the device was last seen. If the device hasn't been seen yet, it will use Unix epoch as the time it was seen.

Returns:

  • (Float)


14
15
16
# File 'lib/lifx/lan/seen.rb', line 14

def seconds_since_seen
  Time.now - (last_seen || Time.at(0))
end