|
Eris Linux A.P.I. 0.1
API to access Eris Linux system from a custom container
|
Time and timezone related functions. More...
Functions | |
| int | eris_get_ntp_server (char *buffer, size_t size) |
| Get the current NTP server used by the machine. | |
| int | eris_set_ntp_server (const char *server) |
| Set the NTP server to use by the machine. | |
| int | eris_get_ntp_enable (char *buffer, size_t size) |
| Get the current NTP status. | |
| int | eris_set_ntp_enable (const char *status) |
| Set the NTP status. | |
| int | eris_list_time_zones (char *buffer, size_t size) |
| List the timezones known by the system. | |
| int | eris_get_time_zone (char *buffer, size_t size) |
| Get the current timezone of the system. | |
| int | eris_set_time_zone (const char *timezone) |
| Set the system timezone. | |
| int | eris_get_local_time (char *buffer, size_t size) |
| Get the local time. | |
| int | eris_get_system_time (char *buffer, size_t size) |
| Get the system time. | |
| int | eris_set_system_time (const char *time) |
| Set the system time. | |
Time and timezone related functions.
| int eris_get_local_time | ( | char * | buffer, |
| size_t | size ) |
Get the local time.
This function fills the provided buffer with the local time.
The local time is computed using the timezone of the system.
The format for local time is YYYY-MM-DD hh:mm:ss:uuuuuu (uuuuuu represents microseconds).
| buffer | the buffer to fill. |
| size | the size of the buffer. |
The buffer zie must be at least 27 bytes.
| int eris_get_ntp_enable | ( | char * | buffer, |
| size_t | size ) |
Get the current NTP status.
This functions fills the provided buffer with the string yes or no depending whether the NTP usage is currently enabled or disabled.
| buffer | the buffer to fill with the NTP status. |
| size | the size of the buffer. |
| int eris_get_ntp_server | ( | char * | buffer, |
| size_t | size ) |
Get the current NTP server used by the machine.
This function fills the provided buffer with the current NTP server.
| buffer | the buffer to fill with the server adress or name. |
| size | the size of the buffer. |
A NTP (Network Time Protocol) server is a machine with a precise time keeping source (GPS, atomic clock, etc.). This server is configured to answer other machine's requests to setup their own system clock.
There are many NTP servers on Internet. The one used by default by Eris is pool.ntp.org, but you can prefer your own server (maybe on a local network, or totaly disable the NTP use.
| int eris_get_system_time | ( | char * | buffer, |
| size_t | size ) |
Get the system time.
This function fills the provided buffer with the system time (i.e. the current time in UTC timezone).
The system clock is configured (using NTP for example) and maintained in UTC (Universal Time Coordinate) timezone.
The format for system time is YYYY-MM-DD hh:mm:ss:uuuuuu (uuuuuu represents microseconds).
| buffer | the buffer to fill. |
| size | the size of the buffer. |
The buffer zie must be at least 27 bytes.
| int eris_get_time_zone | ( | char * | buffer, |
| size_t | size ) |
Get the current timezone of the system.
This function fills the provided buffer with the name of the timezone used to display local time.
| buffer | the buffer to fill with the timezone name |
| size | the size of the buffer. |
| int eris_list_time_zones | ( | char * | buffer, |
| size_t | size ) |
List the timezones known by the system.
This function fills the provided buffer with the list of all timezones available.
| buffer | the buffer to fill with the list of timezone. |
| size | the size of the buffer. |
The recommanded size of the buffer is about 10kbytes.
| int eris_set_ntp_enable | ( | const char * | status | ) |
Set the NTP status.
This function stores the NTP status (yes or no) to enable or disable NTP usage.
| status | yes or no. |
| int eris_set_ntp_server | ( | const char * | server | ) |
Set the NTP server to use by the machine.
This function stores the given NTP server in Eris system.
| server | the hostname or the IP address of the NTP server. |
| int eris_set_system_time | ( | const char * | time | ) |
Set the system time.
This function sets the system clock with the (UTC timezone) time provided in the buffer.
The format for system time may be:
| time | the system time. |
| int eris_set_time_zone | ( | const char * | timezone | ) |
Set the system timezone.
This function stores the name of the timezone to use when computing local time.
The name must be in the list returned by eris_list_time_zones().
| timezone | the name of the timezone. |