Skip to main content
Version: v3+

WORLD_CLOCK

Creating Sensors​

const world_clock = hmSensor.createSensor(hmSensor.id.WORLD_CLOCK)

WORLD_CLOCK instance​

world_clock.init​

Initialize world clock data

Type​

() => void

world_clock.getWorldClockCount​

Get the total number of currently configured world clocks

Type​

() => number

world_clock.getWorldClockCountInfo(index)​

Get the world clock data corresponding to index

Type​

(index: number) => wordInfo
wordInfo​
PropertiesDescriptionType
citycitystring
hourhournumber
minuteminutenumber
timeZoneHourTime Zone Hoursnumber
timeZoneMinuteTime zone minutesnumber

world_clock.uninit​

Recycle world clock data, corresponding to init

Type​

() => void

Code example​

const world_clock = hmSensor.createSensor(hmSensor.id.WORLD_CLOCK)
world_clock.init()
const count = world_clock.getWorldClockCount()
if (count > 0) {
const worldData = world_clock.getWorldClockInfo(0)
console.log('worldName=' + worldData.city)
console.log('worldHour=' + worldData.hour)
console.log('worldMinute=' + worldData.minute)
}
world_clock.uninit()