Constructor
new TimeDateService()
Methods
(async) connect()
Connects to the timedate daemon
(async) getCanNTP() → {boolean}
Returns true if an NTP service is available
Returns:
true if the service is available
- Type
- boolean
(async) getNTP() → {boolean}
Returns true when NTP sync is enabled
Returns:
true when NTP sync is enabled
- Type
- boolean
(async) getNTPSynchronized() → {boolean}
Returns true when the time is in-sync with the upstream NTP server
Returns:
true when the time is in-sync
- Type
- boolean
(async) getTime() → {Date}
Gets the current time
Returns:
A Date object representing now
- Type
- Date
(async) getTimezone() → {string}
Gets the current Timezone
Returns:
The selected timezone
- Type
- string
(async) setNTP(useNtp)
Enables or disables NTP
Parameters:
Name | Type | Description |
---|---|---|
useNtp |
boolean | true to enable NTP |
(async) setTime(time)
Sets the current time. Requires NTP to be turned off
Parameters:
Name | Type | Description |
---|---|---|
time |
Date | Number | the new time |
(async) setTimezone(timezone)
Sets the current timezone
Parameters:
Name | Type | Description |
---|---|---|
timezone |
string | the IANA timezone identifier such as "Europe/Amsterdam" |