Time
Access time-specific functions.
TimeZone
The current timezone can be accessed and modified using the getTimeZone, setTimeZone and getCurrentTimeZone, getAvailableTimeZones, setTimeZoneByString sets of functions.
Clock Availability
Most of our STBs do not have a built in permanent clock. This means that, whenever the STB reboots, the time is reset to the UNIX epoch (1 January 1970). The STB then tries to get the time from an NTP server, or if that fails, from a DVB stream. We provide the isTimeSet which you can poll to find out if one of these methods has succeded in setting the correct time. Until the time is set, you should avoid doing things that will malfunction if the clock is wrong, such as showing the current time in the UI, or trying to establish SSL connections.
Members
TimeZone
Enum for timezones.
Properties:
| Name | Type | Description |
|---|---|---|
UTC | UTC | |
MIDWAY_ISLAND | Midway Island | |
HAWAII | Hawaii | |
ALASKA | Alaska | |
PACIFIC_TIME | Pacific Time | |
ARIZONA | Arizona | |
MOUNTAIN_TIME | Mountain Time | |
CENTRAL_AMERICA | Central America | |
CENTRAL_TIME | Central Time | |
BOGOTA | Bogota | |
VENEZUELA | Venezuela | |
EASTERN_TIME | Eastern Time | |
ATLANTIC_TIME | Atlantic Time | |
GREECE | Greece | |
BRAZIL | Brazil | |
GREENLAND | Greenland | |
NEWFOUNDLAND | Newfoundland | |
MID_ATLANTIC | Mid Atlantic | |
AZORES | Azores | |
UNITED_KINGDOM | United Kingdom | |
CENTRAL_EUROPEAN | Central European | |
WEST_AFRICA_TIME | West Africa Time | |
WINDHOEK | Windhoek | |
CAIRO | Cairo | |
KUWAIT | Kuwait | |
MOSCOW | Moscow | |
DUBAI | Dubai | |
TEHRAN | Tehran | |
PAKISTAN | Pakistan | |
SRI_LANKA | Sri Lanka | |
KATHMANDU | Kathmandu | |
ASTANA | Astana | |
YANGON | Yangon | |
BANGKOK | Bangkok | |
CHINA | China | |
JAPAN | Japan | |
KOREA | Korea | |
DARWIN | Darwin | |
BRISBANE | Brisbane | |
ADELINE | Adeline | |
SYDNEY | Sydney | |
MARSHALL_ISLANDS | Marshall Islands | |
NEW_ZEALAND | New Zealand | |
TONGA | Tonga |
Methods
getAvailableTimeZones()
Get all the timezones supported by the system. The completion handler will be passed the following arguments:
- time_zones: An array of strings containing all the supported timezones.
getCurrentTimeZone()
Get the current time zone. The completion handler will be passed the following arguments:
- time_zone: The system timezone in the form of string as defined in getAvailableTimeZones().
getTimeZone()
Get the current time zone. The completion handler will be passed the following arguments:
- time_zone: The current TimeZone.
isTimeSet()
Returns true if the clock has been initialized after a reboot. The completion handler will be passed the following arguments:
- is_set: Will be true if the clock has been initialized.
setTimeZone(time_zone)
Sets the time zone.
Parameters:
| Name | Type | Description |
|---|---|---|
time_zone | TimeZone | The desired TimeZone. |
Returns:
| Type | Description |
|---|---|
| A promise. | No arguments are passed to the completion handler. |
setTimeZoneByString(time_zone)
Set the system timezone by providing a string.
Parameters:
| Name | Type | Description |
|---|---|---|
time_zone | String | The timezone to set the system to. Expected values are the ones returned by getAvailableTimeZones(). |