williamr@2: /* williamr@2: * Copyright (c) 1989, 1993 williamr@2: * The Regents of the University of California. All rights reserved. williamr@2: * (c) UNIX System Laboratories, Inc. williamr@2: * All or some portions of this file are derived from material licensed williamr@2: * to the University of California by American Telephone and Telegraph williamr@2: * Co. or Unix System Laboratories, Inc. and are reproduced herein with williamr@2: * the permission of UNIX System Laboratories, Inc. williamr@2: * williamr@2: * Redistribution and use in source and binary forms, with or without williamr@2: * modification, are permitted provided that the following conditions williamr@2: * are met: williamr@2: * 1. Redistributions of source code must retain the above copyright williamr@2: * notice, this list of conditions and the following disclaimer. williamr@2: * 2. Redistributions in binary form must reproduce the above copyright williamr@2: * notice, this list of conditions and the following disclaimer in the williamr@2: * documentation and/or other materials provided with the distribution. williamr@2: * 4. Neither the name of the University nor the names of its contributors williamr@2: * may be used to endorse or promote products derived from this software williamr@2: * without specific prior written permission. williamr@2: * williamr@2: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND williamr@2: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE williamr@2: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE williamr@2: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE williamr@2: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL williamr@2: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS williamr@2: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) williamr@2: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT williamr@2: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY williamr@2: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF williamr@2: * SUCH DAMAGE. williamr@2: * williamr@2: * @(#)time.h 8.3 (Berkeley) 1/21/94 williamr@4: * © Portions Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. williamr@2: */ williamr@2: williamr@2: /* williamr@2: * $FreeBSD: src/include/time.h,v 1.32 2005/04/02 12:33:27 das Exp $ williamr@2: */ williamr@2: williamr@2: #ifndef _TIME_H_ williamr@2: #define _TIME_H_ williamr@2: williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #ifdef __SYMBIAN32__ williamr@2: #include williamr@2: #endif williamr@2: williamr@2: #if __POSIX_VISIBLE > 0 && __POSIX_VISIBLE < 200112 || __BSD_VISIBLE williamr@2: /* williamr@2: * Frequency of the clock ticks reported by times(). Deprecated - use williamr@2: * sysconf(_SC_CLK_TCK) instead. (Removed in 1003.1-2001.) williamr@2: */ williamr@2: #ifdef __SYMBIAN32__ williamr@2: #define CLK_TCK 128 williamr@2: #endif //__SYMBIAN32__ williamr@2: #endif williamr@2: williamr@2: /* Frequency of the clock ticks reported by clock(). */ williamr@2: #ifndef __SYMBIAN32__ williamr@2: #define CLOCKS_PER_SEC 128 williamr@2: #endif //__SYMBIAN32__ williamr@2: williamr@2: #ifndef _CLOCK_T_DECLARED williamr@2: typedef __clock_t clock_t; williamr@2: #define _CLOCK_T_DECLARED williamr@2: #endif williamr@2: williamr@2: #ifndef _TIME_T_DECLARED williamr@2: typedef __time_t time_t; williamr@2: #define _TIME_T_DECLARED williamr@2: #endif williamr@2: williamr@2: #ifndef _SIZE_T_DECLARED williamr@2: typedef __size_t size_t; williamr@2: #define _SIZE_T_DECLARED williamr@2: #endif williamr@2: williamr@2: #if __POSIX_VISIBLE >= 199309 williamr@2: /* williamr@2: * New in POSIX 1003.1b-1993. williamr@2: */ williamr@2: #ifndef _CLOCKID_T_DECLARED williamr@2: typedef __clockid_t clockid_t; williamr@2: #define _CLOCKID_T_DECLARED williamr@2: #endif williamr@2: williamr@2: #ifndef _TIMER_T_DECLARED williamr@2: typedef __timer_t timer_t; williamr@2: #define _TIMER_T_DECLARED williamr@2: #endif williamr@2: williamr@2: #include williamr@4: williamr@4: /* POSIX.1b structure for timer start values and intervals. */ williamr@4: struct itimerspec williamr@4: { williamr@4: struct timespec it_interval; williamr@4: struct timespec it_value; williamr@4: }; williamr@4: williamr@4: /* We can use a simple forward declaration. */ williamr@4: struct sigevent; williamr@2: #endif /* __POSIX_VISIBLE >= 199309 */ williamr@2: williamr@2: /* These macros are also in sys/time.h. */ williamr@2: #if !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112 williamr@2: #define CLOCK_REALTIME 0 williamr@2: #ifdef __BSD_VISIBLE williamr@2: #define CLOCK_VIRTUAL 1 williamr@2: #define CLOCK_PROF 2 williamr@2: #endif williamr@2: #define CLOCK_MONOTONIC 4 williamr@2: #endif /* !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112 */ williamr@2: williamr@2: #if !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 200112 williamr@2: #if __BSD_VISIBLE williamr@2: #define TIMER_RELTIME 0x0 /* relative timer */ williamr@2: #endif williamr@2: #define TIMER_ABSTIME 0x1 /* absolute timer */ williamr@2: #endif /* !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 200112 */ williamr@2: williamr@2: struct tm { williamr@2: int tm_sec; /* seconds after the minute [0-60] */ williamr@2: int tm_min; /* minutes after the hour [0-59] */ williamr@2: int tm_hour; /* hours since midnight [0-23] */ williamr@2: int tm_mday; /* day of the month [1-31] */ williamr@2: int tm_mon; /* months since January [0-11] */ williamr@2: int tm_year; /* years since 1900 */ williamr@2: int tm_wday; /* days since Sunday [0-6] */ williamr@2: int tm_yday; /* days since January 1 [0-365] */ williamr@2: int tm_isdst; /* Daylight Savings Time flag */ williamr@2: long tm_gmtoff; /* offset from UTC in seconds */ williamr@2: char *tm_zone; /* timezone abbreviation */ williamr@2: }; williamr@2: williamr@2: #if __POSIX_VISIBLE williamr@2: extern char *tzname[]; williamr@2: #endif williamr@2: williamr@2: __BEGIN_DECLS williamr@2: #ifdef __SYMBIAN32__ williamr@2: IMPORT_C char*** __tzname(void); williamr@2: #define tzname (*__tzname()) williamr@2: #endif //__SYMBIAN32__ williamr@2: williamr@2: IMPORT_C williamr@2: char *asctime(const struct tm *); williamr@2: IMPORT_C williamr@2: clock_t clock(void); williamr@2: IMPORT_C williamr@2: char *ctime(const time_t *); williamr@2: IMPORT_C williamr@2: double difftime(time_t, time_t); williamr@2: /* XXX missing: getdate() */ williamr@2: IMPORT_C williamr@2: struct tm *gmtime(const time_t *); williamr@2: IMPORT_C williamr@2: struct tm *localtime(const time_t *); williamr@2: IMPORT_C williamr@2: time_t mktime(struct tm *); williamr@2: IMPORT_C williamr@2: size_t strftime(char * __restrict, size_t, const char * __restrict, williamr@2: const struct tm * __restrict); williamr@2: IMPORT_C williamr@2: time_t time(time_t *); williamr@2: williamr@2: #if __POSIX_VISIBLE williamr@2: IMPORT_C williamr@2: void tzset(void); williamr@2: #endif williamr@2: williamr@2: #if __POSIX_VISIBLE >= 199309 williamr@2: IMPORT_C williamr@2: int clock_getres(clockid_t, struct timespec *); williamr@2: IMPORT_C williamr@2: int clock_gettime(clockid_t, struct timespec *); williamr@2: IMPORT_C williamr@2: int clock_settime(clockid_t, const struct timespec *); williamr@2: /* XXX missing: clock_nanosleep() */ williamr@2: IMPORT_C williamr@2: int nanosleep(const struct timespec *, struct timespec *); williamr@4: williamr@4: //////////////////////////LIBRT: START///////////////////////////////// williamr@4: williamr@4: /* Create new per-process timer using CLOCK_ID. */ williamr@4: IMPORT_C int timer_create (clockid_t __clock_id, williamr@4: struct sigevent *__restrict __evp, williamr@4: timer_t *__restrict __timerid); williamr@4: williamr@4: /* Delete timer TIMERID. */ williamr@4: IMPORT_C int timer_delete (timer_t __timerid); williamr@4: williamr@4: /* Set timer TIMERID to VALUE, returning old value in OVLAUE. */ williamr@4: IMPORT_C int timer_settime (timer_t __timerid, int __flags, williamr@4: const struct itimerspec *__restrict __value, williamr@4: struct itimerspec *__restrict __ovalue); williamr@4: williamr@4: /* Get current value of timer TIMERID and store it in VLAUE. */ williamr@4: IMPORT_C int timer_gettime (timer_t __timerid, struct itimerspec *__value); williamr@4: williamr@4: /* Get expiration overrun for timer TIMERID. */ williamr@4: IMPORT_C int timer_getoverrun (timer_t __timerid); williamr@4: williamr@4: IMPORT_C int clock_nanosleep(clockid_t clock_id, int flags, williamr@4: const struct timespec *rqtp, struct timespec *rmtp); williamr@4: //////////////////////////LIBRT: END///////////////////////////////// williamr@4: williamr@2: #endif /* __POSIX_VISIBLE >= 199309 */ williamr@2: williamr@2: #ifdef __SYMBIAN32__ williamr@2: IMPORT_C williamr@2: int clock_getcpuclockid(pid_t , clockid_t *); williamr@2: #endif //__SYMBIAN32__ williamr@2: williamr@2: williamr@2: #if __POSIX_VISIBLE >= 199506 williamr@2: IMPORT_C williamr@2: char *asctime_r(const struct tm *, char *); williamr@2: IMPORT_C williamr@2: char *ctime_r(const time_t *, char *); williamr@2: IMPORT_C williamr@2: struct tm *gmtime_r(const time_t *, struct tm *); williamr@2: IMPORT_C williamr@2: struct tm *localtime_r(const time_t *, struct tm *); williamr@2: #endif williamr@2: williamr@2: #if __XSI_VISIBLE williamr@2: IMPORT_C williamr@2: char *strptime(const char * __restrict, const char * __restrict, williamr@2: struct tm * __restrict); williamr@2: #endif williamr@2: williamr@2: #if __BSD_VISIBLE williamr@2: char *timezone(int, int); /* XXX XSI conflict */ williamr@2: #ifndef __SYMBIAN32__ williamr@2: void tzsetwall(void); williamr@2: #endif //__SYMBIAN32__ williamr@2: time_t timelocal(struct tm * const); williamr@2: IMPORT_C time_t timegm(struct tm * const); williamr@2: #endif /* __BSD_VISIBLE */ williamr@2: __END_DECLS williamr@2: williamr@2: #endif /* !_TIME_H_ */