System Time & Timezone Interface
[System]


Data Structures

struct  _AlpNotifyEventSystemChangeTime
struct  _AlpNotifyEventSystemChangeZone
#define ALP_MAX_TIMEZONE_LEN   64

System time change notifications

#define ALP_NOTIFY_EVENT_SYSTEM_CHANGE   "/alp/system/change/"
#define ALP_NOTIFY_EVENT_SYSTEM_CHANGE_TIME   "/alp/system/change/time"
#define ALP_NOTIFY_EVENT_SYSTEM_CHANGE_ZONE   "/alp/system/change/zone"
typedef _AlpNotifyEventSystemChangeTime AlpNotifyEventSystemChangeTime
typedef _AlpNotifyEventSystemChangeZone AlpNotifyEventSystemChangeZone

System Time Error Codes

#define ALP_STATUS_SYSTEM_TIME_BAD_PARAM   (ALP_CLASS_SYSTEM_TIME | 0x00010000)
 Invalid parameter value.
#define ALP_STATUS_SYSTEM_TIME_NO_MEMORY   (ALP_CLASS_SYSTEM_TIME | 0x00020000)
 Memory allocation failed.
#define ALP_STATUS_SYSTEM_TIME_NO_PERM   (ALP_CLASS_SYSTEM_TIME | 0x00040000)
 Operation not allowed.
#define ALP_STATUS_SYSTEM_TIME_NO_SERVER   (ALP_CLASS_SYSTEM_TIME | 0x00030000)
 Unable to connect to daemon.

Time functions

int alp_sys_adjtime (const struct timeval *delta, struct timeval *old_delta)
 Change system clock time with gradual adjustments.
int alp_sys_settimeofday (const struct timeval *tv, const struct timezone *tz)
 Set the system time given the number of seconds and microseconds since the Epoch.
See also:
settime.

int alp_sys_stime (const time_t *when)
 Set the system time given the number of seconds since the Epoch.

Timezone functions

int alp_sys_gettimezone (char *name, int len)
 Get the default system timezone.
int alp_sys_settimezone (const char *zonename)
 Set the default system timezone.
int alp_sys_settimezone_from_offset (int offset, const char *zone)
 Set default system timezone from offset information.


Define Documentation

#define ALP_MAX_TIMEZONE_LEN   64
 

#define ALP_NOTIFY_EVENT_SYSTEM_CHANGE   "/alp/system/change/"
 

#define ALP_NOTIFY_EVENT_SYSTEM_CHANGE_TIME   "/alp/system/change/time"
 

#define ALP_NOTIFY_EVENT_SYSTEM_CHANGE_ZONE   "/alp/system/change/zone"
 

#define ALP_STATUS_SYSTEM_TIME_BAD_PARAM   (ALP_CLASS_SYSTEM_TIME | 0x00010000)
 

Invalid parameter value.

#define ALP_STATUS_SYSTEM_TIME_NO_MEMORY   (ALP_CLASS_SYSTEM_TIME | 0x00020000)
 

Memory allocation failed.

#define ALP_STATUS_SYSTEM_TIME_NO_PERM   (ALP_CLASS_SYSTEM_TIME | 0x00040000)
 

Operation not allowed.

#define ALP_STATUS_SYSTEM_TIME_NO_SERVER   (ALP_CLASS_SYSTEM_TIME | 0x00030000)
 

Unable to connect to daemon.


Typedef Documentation

typedef struct _AlpNotifyEventSystemChangeTime AlpNotifyEventSystemChangeTime
 

typedef struct _AlpNotifyEventSystemChangeZone AlpNotifyEventSystemChangeZone
 


Function Documentation

int alp_sys_adjtime const struct timeval *  delta,
struct timeval *  old_delta
 

Change system clock time with gradual adjustments.

Parameters:
[in] delta A pointer to a timeval structure that specifies a relative adjustment to be made to the clock time. If negative, the system clock is slowed down for a period of time until it has lost the specified elapsed time. If positive, the system clock is speed up for a period of time until it has gained the specified elapsed time.
[in] old_delta A pointer to a timeval structure. If this not NULL, it returns any previous time adjustment that has not yet been completed.
Returns:
0 on success

-1 on error, errno is set appropriately

See also:
adjtime(2).

int alp_sys_gettimezone char *  name,
int  len
 

Get the default system timezone.

alp_sys_gettimezone() will return current default timezone in the array name, NUL-terminated. If len is less than length of timezone, the timezone will be truncated (with NUL placed in last position of the array).

Parameters:
[out] name a location to store the current system default uniform timezone name.
[in] len the maximum number of bytes that will stored in name
Returns:
0 on success

-1 on error, errno is set to EFAULT if name is an invalid address (NULL), or to EINVALID if len is negative, and to ENAMETOOLONG if the specified len is smaller than the size to store the NUL-terminated timezone

See also:
tzfile(5).

int alp_sys_settimeofday const struct timeval *  tv,
const struct timezone *  tz
 

Set the system time given the number of seconds and microseconds since the Epoch.

See also:
settime.

Only processes that are allowed by the ALP Security Policy Framework may use this call.

At completion of the time change, an ALP_NOTIFY_EVENT_SYSTEM_CHANGE_TIME notify will be broadcasted for any interested parties.

Parameters:
[in] tv A pointer to a timeval structure.
See also:
sys/time.h.
Parameters:
[in] tz A pointer to a timezone structure.
Note:
From the settimeofday(2) manual page: The use of the timezone struct is obsolete; the tz_dsttime field has never been used under Linux - it has not been and will not be supported by libc or glibc. Each and every occurrence of this field in the kernel source (other than the declaration) is a bug.
Thus, the support here is purely for historic reasons. It will be necessary to supply a pointer to a valid timezone structure which will otherwise be ignored.

Returns:
0 on success

-1 on error, errno is set appropriately

See also:
settimeofday(2).

int alp_sys_settimezone const char *  zonename  ) 
 

Set the default system timezone.

zonename is the name of the compiled zoneinfo file containing the the rules of the desired timezone. This name is the portion of the filename below /usr/share/zoneinfo. For instance, if the desired zoneinfo file is located at /usr/share/zoneinfo/Europe/Paris, then the zonename would be Europe/Paris.

Parameters:
[in] zonename a uniform timezone name in the form of area/location, such as America/New_York.
Returns:
0 on success

-1 on error, errno is set appropriately

See also:
Linux manual pages for dump(1), tzset(3), tzfile(5) and zic(8).

int alp_sys_settimezone_from_offset int  offset,
const char *  zone
 

Set default system timezone from offset information.

alp_sys_settimezone_from_offset() takes an integer offset value which represent the number of quarter hours offset from UTC.

Parameters:
[in] offset the number of seconds east of UTC, positive values are east of UTC, negative are west.
[in] zone an optional string specifying the abbreviated name of the current timezone, NULL if not available If not specified, an abbreviation of the form GMT<+|->HH[.hh] will be used. HH is hours and hh is the 100ths of an hour. An example for an offset of 6:45 would be GMT+6.75.
Returns:
0 on success

-1 on error, errno is set appropriately

int alp_sys_stime const time_t *  when  ) 
 

Set the system time given the number of seconds since the Epoch.

Set system time with the time pointed to by when which contains the number of seconds since the Epoch which is 00:00:00 GMT January 1, 1970.

Only processes that are allowed by the ALP Security Policy Framework may use call.

At completion of the time change, an ALP_NOTIFY_EVENT_SYSTEM_CHANGE_TIME notify will be broadcasted for any interested parties.

Parameters:
[in] when pointer to time_t value
Returns:
0 on success

-1 on error, errno is set appropriately

See also:
stime(2).


Generated on Wed Jul 30 07:06:44 2008 by Doxygen 1.4.6 for ALP SDK + Hiker Documentation

Copyright © 1999-2008 ACCESS CO., LTD. All rights reserved.