Sleep

class Sleep

Sleep is amount of episodes of sleep ended in specified day with gap between each of episode no more than SLEEP_GAP.

All fields can be calculated from episodes but for saving time they has been calculated during Sleep instance creation.

See also

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

count of awakes during the sleep (e.g. gaps between episodes of sleep).

Link copied to clipboard

Duration of awakes during the sleep. Default units: TimeUnit.SECONDS.

Link copied to clipboard

Duration of the sleep in seconds (doesn't include awakesDuration). Default units: TimeUnit.SECONDS.

Link copied to clipboard
val end: Timestamp

end of the sleep in UNIX-timestamp.

Link copied to clipboard

list of episodes of sleep sorted by episodes' end.

Link copied to clipboard

false if last episode of sleep hasn't ended yet

Link copied to clipboard
val start: Timestamp

beginning of the sleep in UNIX-timestamp.

Functions

Link copied to clipboard

Returns list of awakes as range from awake start to awake end.

Link copied to clipboard
fun getAwakesDuration(units: TimeUnit = TimeUnit.SECONDS): Long

Returns awakes duration in specified time units.

Link copied to clipboard
fun getDuration(units: TimeUnit = TimeUnit.SECONDS): Long

Returns sleep duration that doesn't includes awakesDuration in specified time units.

Link copied to clipboard
fun getTotalDuration(units: TimeUnit = TimeUnit.SECONDS): Long

Returns total sleep duration (includes duration of awakes) in specified time units.