Library: times

From Yombo
Jump to: navigation, search
times
Commonly Used Yes
Status Active

Summary
Get information on times things happen in the sky or perform various time conversions.

Introduction

The Times library is primarily responsible for defining various Template:library to reflect if the sun is up, down, twilight, dusk, dawn, if it's light outside, next sunrise, etc. In addition the the defined states, it can also be used to lookup if an object is visible or when it sets or rises. This includes: Sun. Moon, Mercury, Venus, Mars, Jupiter, Saturn, Uranus, Neptune, and Pluto.

This library can also perform various time conversions.

See also

Hooks

  • _time_event_ - The Times library lets the system know when sunrise, sunset, dusk, dawn, or twilight is. Will trigger system events when these start or stop.

Usage

See examples.

Examples

Determine if Saturn is visible

1 saturn_visible = self._Times.item_visible('Saturn') # Is Saturn above the horizon? (True/False)

Determine when Mars rises

1 mars_rise = self._Times.item_rise(dayOffset=1, item='Saturn') # the NEXT (1) rising of Mars.

Determine when Pluto sets

1 pluto_set = self._Times.item_set(dayOffset=0, item='Pluto') # the NEXT (0) setting of Pluto
2 (True/False)


Defined States

A list of defined states set by this library:

  • is.dark - True if sun is below horizon and not twilight
  • is.light - True if sun is above horizon and twilight.
  • is.day  - True if sun above horizon.
  • is.night - True if sun below horizon.
  • is.dawn - True if sun below horizon, sun rising and still below horizon.
  • is.dusk - True if sun below horizon, sun setting and below horizon.
  • is.twilight - True if sun below horizon but still light.
  • next.sunrise - Time until next sunrise.
  • next.sunset - Time until next sunset.
  • next.moonrise - Time until next moon rise.
  • next.moonset - Time until next moon set.
This page was last edited on 9 December 2017.