WorldClock
Start from API_LEVEL
3.0. Please refer to API_LEVEL.
World Clock Sensor.
Methods
getCount
Get the number of configured world clocks
getCount(): number
getInfo
Get the configured world clock information according to the index
getInfo(index: number): WorldClockInfo
WorldClockInfo
| Property | Type | Description | API_LEVEL |
|---|---|---|---|
| city | string | City Name | 3.0 |
| cityCode | string | City code, e.g. San Francisco SFO | 3.0 |
| hour | number | Hour | 3.0 |
| minute | number | Minute | 3.0 |
| timeZoneHour | number | Time Zone hours | 3.0 |
| timeZoneMinute | number | Time zone minutes | 3.0 |
Example
import { WorldClock } from '@zos/sensor'
const worldClock = new WorldClock()
const worldClockCount = worldClock.getCount()
for (let i = 0; i < worldClockCount; i++) {
const worldClockInfo = worldClock.getInfo(i)
console.log(worldClockInfo.city)
console.log(worldClockInfo.cityCode)
console.log(worldClockInfo.hour)
console.log(worldClockInfo.minute)
console.log(worldClockInfo.timeZoneHour)
console.log(worldClockInfo.timeZoneMinute)
}
// When not needed for use
worldClock.destroy()