Legrand / Raritan / Server Technology Xerus™ JSON-RPC API
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
datetime::DateTime Interface Reference

Date and time configuration methods. More...

Classes

struct  Cfg
 Device date and time configuration. More...
 
struct  ClockChangedEvent
 Event that is sent when the device time is changed. More...
 
struct  ConfigurationChangedEvent
 Event that is sent when the configuration changes. More...
 
struct  NtpCfg
 Static NTP server configuration. More...
 
struct  ZoneCfg
 Time zone configuration. More...
 
struct  ZoneInfo
 Time zone information (see also ZoneCfg) More...
 

Public Types

enum  Protocol { STATIC , NTP }
 Time synchronization protocol. More...
 

Public Member Functions

void getZoneInfos (out vector< ZoneInfo > zoneInfos, in boolean useOlson)
 List all supported time zones. More...
 
boolean checkNtpServer (in string ntpServer)
 Check if a specified NTP server is usable. More...
 
vector< string > getActiveNtpServers ()
 Get active NTP servers. More...
 
void getCfg (out Cfg cfg)
 Retrieve the device date and time configuration. More...
 
int setCfg (in Cfg cfg)
 Set the device date and time configuration. More...
 
void getTime (in boolean useOlson, out ZoneInfo zone, out boolean dstEnabled, out int utcOffset, out time currentTime)
 Retrieve the current device date and time. More...
 

Detailed Description

Date and time configuration methods.

Example to set timezone (id-based approach):

zoneinfos = getZoneInfos(False)
cfg = getCfg()
cfg.zoneCfg.id = ... # choose zone id from returned zoneinfos
status = setCfg(cfg)
if status != 0: ... # error handling

Definition at line 25 of file DateTime.idl.

Member Enumeration Documentation

◆ Protocol

Time synchronization protocol.

Enumerator
STATIC 

Device time is configured locally.

NTP 

Device time is synchronized via NTP.

Definition at line 67 of file DateTime.idl.

Member Function Documentation

◆ checkNtpServer()

boolean datetime::DateTime::checkNtpServer ( in string  ntpServer)

Check if a specified NTP server is usable.

Parameters
ntpServerNTP server to be checked
Returns
true if the NTP server is usable

◆ getActiveNtpServers()

vector< string > datetime::DateTime::getActiveNtpServers ( )

Get active NTP servers.

Returns
List of currently active NTP servers (IP addresses and/or hostnames)

◆ getCfg()

void datetime::DateTime::getCfg ( out Cfg  cfg)

Retrieve the device date and time configuration.

Parameters
cfgResult: Current date and time configration

◆ getTime()

void datetime::DateTime::getTime ( in boolean  useOlson,
out ZoneInfo  zone,
out boolean  dstEnabled,
out int  utcOffset,
out time  currentTime 
)

Retrieve the current device date and time.

Parameters
useOlsonUse Olson timezone name (see also ZoneCfg)
zoneResult: Active time zone
dstEnabledif false, the time zone daylight saving time flag is not used
utcOffsetResult: Offset (in minutes) between local time and UTC
currentTimeResult: Device date and time (UNIX timestamp, UTC)

◆ getZoneInfos()

void datetime::DateTime::getZoneInfos ( out vector< ZoneInfo zoneInfos,
in boolean  useOlson 
)

List all supported time zones.

Parameters
zoneInfosResult: List of time zones
useOlsonUse Olson timezone names (see also ZoneCfg)

◆ setCfg()

int datetime::DateTime::setCfg ( in Cfg  cfg)

Set the device date and time configuration.

Depending on the value of the protocol field either deviceTime or ntpCfg will be used from the cfg parameter.

Specific example to set timezone.

Parameters
cfgNew date and time configuration.
Returns
0 if OK
1 if the configuration is invalid

The documentation for this interface was generated from the following file: