00001 /****************************************************************************** 00002 * 00003 * Copyright (c) 1999-2008 ACCESS CO., LTD. All rights reserved. 00004 * Copyright 2006, 2007, ACCESS Systems Americas, Inc. All rights reserved. 00005 * 00006 * Version: MPL 1.1/LGPL 2.1 00007 * 00008 * The contents of this file are subject to the Mozilla Public License Version 00009 * 1.1 (the "License"); you may not use this file except in compliance with 00010 * the License. You may obtain a copy of the License at 00011 * http://www.mozilla.org/MPL/ 00012 * 00013 * Software distributed under the License is distributed on an "AS IS" basis, 00014 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 00015 * for the specific language governing rights and limitations under the 00016 * License. 00017 * 00018 * The Original Code is hikerproject.org code. 00019 * 00020 * The Initial Developer of the Original Code is ACCESS Systems Americas, Inc. 00021 * Portions created by the Initial Developer are 00022 * Copyright 2006-2007 the Initial Developer. All Rights Reserved. 00023 * 00024 * Contributor(s): 00025 * 00026 * Alternatively, the contents of this file may be used under the terms of 00027 * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which 00028 * case the provisions of the LGPL are applicable instead of those above. 00029 * If you wish to allow use of your version of this file only under the terms 00030 * of the LGPL, and not to allow others to use your version of this file under 00031 * the terms of the MPL, indicate your decision by deleting the provisions 00032 * above and replace them with the notice and other provisions required by 00033 * the LGPL. If you do not delete the provisions above, a recipient may use 00034 * your version of this file under the terms of either the MPL or the LGPL. 00035 * You may obtain a copy of the LGPL at http://www.gnu.org/licenses/lgpl.txt. 00036 * 00037 *****************************************************************************/ 00045 #ifndef __HIKER_SYS_TIME_H__ 00046 #define __HIKER_SYS_TIME_H__ 00047 00048 #include <sys/types.h> 00049 #include <sys/time.h> 00050 00051 #include <hiker/sysclass.h> 00052 #include <hiker/types.h> 00053 00054 #ifdef __cplusplus 00055 extern "C" { 00056 #endif 00057 00069 #define ALP_STATUS_SYSTEM_TIME_BAD_PARAM (ALP_CLASS_SYSTEM_TIME | 0x00010000) 00070 #define ALP_STATUS_SYSTEM_TIME_NO_MEMORY (ALP_CLASS_SYSTEM_TIME | 0x00020000) 00071 #define ALP_STATUS_SYSTEM_TIME_NO_SERVER (ALP_CLASS_SYSTEM_TIME | 0x00030000) 00072 #define ALP_STATUS_SYSTEM_TIME_NO_PERM (ALP_CLASS_SYSTEM_TIME | 0x00040000) 00073 00074 /* @} */ /* end of System Time Error Codes */ 00075 00076 /* @{ */ 00077 #define ALP_MAX_TIMEZONE_LEN 64 00078 /* @} */ /* end of misc definition section */ 00079 00084 #define ALP_NOTIFY_EVENT_SYSTEM_CHANGE "/alp/system/change/" 00085 00086 #define ALP_NOTIFY_EVENT_SYSTEM_CHANGE_TIME "/alp/system/change/time" 00087 typedef struct _AlpNotifyEventSystemChangeTime AlpNotifyEventSystemChangeTime; 00088 struct _AlpNotifyEventSystemChangeTime { 00089 pid_t pid; //<! id of process requesting time change 00090 struct timeval oldtime; //<! system time before change 00091 struct timeval newtime; //<! system time being change to 00092 }; 00093 00094 #define ALP_NOTIFY_EVENT_SYSTEM_CHANGE_ZONE "/alp/system/change/zone" 00095 typedef struct _AlpNotifyEventSystemChangeZone AlpNotifyEventSystemChangeZone; 00096 struct _AlpNotifyEventSystemChangeZone { 00097 pid_t pid; //<! id of process requesting time change 00098 char zone[0]; //<! new timezone name 00099 }; 00100 00101 /* @} */ /* end of system time change notifications */ 00102 00127 int alp_sys_stime (const time_t *when); 00128 00158 int alp_sys_settimeofday (const struct timeval *tv, const struct timezone *tz); 00159 00180 int alp_sys_adjtime (const struct timeval *delta, struct timeval *old_delta); 00181 00182 /* @} */ /* end of Time change functions */ 00183 00206 int alp_sys_settimezone (const char *zonename); 00207 00229 int alp_sys_gettimezone (char *name, int len); 00230 00247 int alp_sys_settimezone_from_offset (int offset, const char *zone); 00248 00249 /* @} */ /* end of Timezone functions */ 00250 00251 /* @} */ /* end of HIKER_SYSTEM_TIME group */ 00252 00253 #ifdef __cplusplus 00254 } 00255 #endif 00256 00257 #endif /* __HIKER_SYS_TIME_H__ */
Copyright © 1999-2008 ACCESS CO., LTD. All rights reserved.