os/ossrv/genericopenlibs/openenvcore/include/time.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/openenvcore/include/time.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,252 @@
     1.4 +/*
     1.5 + * Copyright (c) 1989, 1993
     1.6 + *	The Regents of the University of California.  All rights reserved.
     1.7 + * (c) UNIX System Laboratories, Inc.
     1.8 + * All or some portions of this file are derived from material licensed
     1.9 + * to the University of California by American Telephone and Telegraph
    1.10 + * Co. or Unix System Laboratories, Inc. and are reproduced herein with
    1.11 + * the permission of UNIX System Laboratories, Inc.
    1.12 + *
    1.13 + * Redistribution and use in source and binary forms, with or without
    1.14 + * modification, are permitted provided that the following conditions
    1.15 + * are met:
    1.16 + * 1. Redistributions of source code must retain the above copyright
    1.17 + *    notice, this list of conditions and the following disclaimer.
    1.18 + * 2. Redistributions in binary form must reproduce the above copyright
    1.19 + *    notice, this list of conditions and the following disclaimer in the
    1.20 + *    documentation and/or other materials provided with the distribution.
    1.21 + * 4. Neither the name of the University nor the names of its contributors
    1.22 + *    may be used to endorse or promote products derived from this software
    1.23 + *    without specific prior written permission.
    1.24 + *
    1.25 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    1.26 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1.27 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    1.28 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    1.29 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    1.30 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    1.31 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    1.32 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    1.33 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    1.34 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.35 + * SUCH DAMAGE.
    1.36 + *
    1.37 + *	@(#)time.h	8.3 (Berkeley) 1/21/94
    1.38 + * © Portions Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
    1.39 + */
    1.40 +
    1.41 +/*
    1.42 + * $FreeBSD: src/include/time.h,v 1.32 2005/04/02 12:33:27 das Exp $
    1.43 + */
    1.44 +
    1.45 +#ifndef _TIME_H_
    1.46 +#define	_TIME_H_
    1.47 +
    1.48 +#include <sys/cdefs.h>
    1.49 +#include <sys/_null.h>
    1.50 +#include <sys/_types.h>
    1.51 +#ifdef __SYMBIAN32__
    1.52 +#include <sys/types.h>
    1.53 +#endif
    1.54 +
    1.55 +#if __POSIX_VISIBLE > 0 && __POSIX_VISIBLE < 200112 || __BSD_VISIBLE
    1.56 +/*
    1.57 + * Frequency of the clock ticks reported by times().  Deprecated - use
    1.58 + * sysconf(_SC_CLK_TCK) instead.  (Removed in 1003.1-2001.)
    1.59 + */
    1.60 +#ifdef __SYMBIAN32__
    1.61 +#define	CLK_TCK		128
    1.62 +#endif //__SYMBIAN32__
    1.63 +#endif
    1.64 +
    1.65 +/* Frequency of the clock ticks reported by clock().  */
    1.66 +#ifndef __SYMBIAN32__
    1.67 +#define	CLOCKS_PER_SEC	128
    1.68 +#endif //__SYMBIAN32__
    1.69 +
    1.70 +#ifndef _CLOCK_T_DECLARED
    1.71 +typedef	__clock_t	clock_t;
    1.72 +#define	_CLOCK_T_DECLARED
    1.73 +#endif
    1.74 +
    1.75 +#ifndef _TIME_T_DECLARED
    1.76 +typedef	__time_t	time_t;
    1.77 +#define	_TIME_T_DECLARED
    1.78 +#endif
    1.79 +
    1.80 +#ifndef _SIZE_T_DECLARED
    1.81 +typedef	__size_t	size_t;
    1.82 +#define	_SIZE_T_DECLARED
    1.83 +#endif
    1.84 +
    1.85 +#if __POSIX_VISIBLE >= 199309
    1.86 +/*
    1.87 + * New in POSIX 1003.1b-1993.
    1.88 + */
    1.89 +#ifndef _CLOCKID_T_DECLARED
    1.90 +typedef	__clockid_t	clockid_t;
    1.91 +#define	_CLOCKID_T_DECLARED
    1.92 +#endif
    1.93 +
    1.94 +#ifndef _TIMER_T_DECLARED
    1.95 +typedef	__timer_t	timer_t;
    1.96 +#define	_TIMER_T_DECLARED
    1.97 +#endif
    1.98 +
    1.99 +#include <sys/timespec.h>
   1.100 +
   1.101 +/* POSIX.1b structure for timer start values and intervals.  */
   1.102 +struct itimerspec
   1.103 +  {
   1.104 +    struct timespec it_interval;
   1.105 +    struct timespec it_value;
   1.106 +  };
   1.107 +
   1.108 +/* We can use a simple forward declaration.  */
   1.109 +struct sigevent; 
   1.110 +#endif /* __POSIX_VISIBLE >= 199309 */
   1.111 +
   1.112 +/* These macros are also in sys/time.h. */
   1.113 +#if !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112
   1.114 +#define CLOCK_REALTIME	0
   1.115 +#ifdef __BSD_VISIBLE
   1.116 +#define CLOCK_VIRTUAL	1
   1.117 +#define CLOCK_PROF	2
   1.118 +#endif
   1.119 +#define CLOCK_MONOTONIC	4
   1.120 +#endif /* !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112 */
   1.121 +
   1.122 +#if !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 200112
   1.123 +#if __BSD_VISIBLE
   1.124 +#define TIMER_RELTIME	0x0	/* relative timer */
   1.125 +#endif
   1.126 +#define TIMER_ABSTIME	0x1	/* absolute timer */
   1.127 +#endif /* !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 200112 */
   1.128 +
   1.129 +struct tm {
   1.130 +	int	tm_sec;		/* seconds after the minute [0-60] */
   1.131 +	int	tm_min;		/* minutes after the hour [0-59] */
   1.132 +	int	tm_hour;	/* hours since midnight [0-23] */
   1.133 +	int	tm_mday;	/* day of the month [1-31] */
   1.134 +	int	tm_mon;		/* months since January [0-11] */
   1.135 +	int	tm_year;	/* years since 1900 */
   1.136 +	int	tm_wday;	/* days since Sunday [0-6] */
   1.137 +	int	tm_yday;	/* days since January 1 [0-365] */
   1.138 +	int	tm_isdst;	/* Daylight Savings Time flag */
   1.139 +	long	tm_gmtoff;	/* offset from UTC in seconds */
   1.140 +	char	*tm_zone;	/* timezone abbreviation */
   1.141 +};
   1.142 +
   1.143 +#if __POSIX_VISIBLE
   1.144 +extern char *tzname[];
   1.145 +#endif
   1.146 +
   1.147 +__BEGIN_DECLS
   1.148 +#ifdef __SYMBIAN32__
   1.149 +#ifdef __WINSCW__
   1.150 +#ifndef __SOFTFP
   1.151 +#define __SOFTFP
   1.152 +#endif /* __SOFTFP */
   1.153 +#endif//__WINSCW__
   1.154 +IMPORT_C char*** __tzname(void);
   1.155 +#define	tzname		(*__tzname())
   1.156 +#endif //__SYMBIAN32__
   1.157 +
   1.158 +IMPORT_C
   1.159 +char *asctime(const struct tm *);
   1.160 +IMPORT_C
   1.161 +clock_t clock(void);
   1.162 +IMPORT_C
   1.163 +char *ctime(const time_t *);
   1.164 +IMPORT_C
   1.165 +double difftime(time_t, time_t) __SOFTFP;
   1.166 +/* XXX missing: getdate() */
   1.167 +IMPORT_C
   1.168 +struct tm *gmtime(const time_t *);
   1.169 +IMPORT_C
   1.170 +struct tm *localtime(const time_t *);
   1.171 +IMPORT_C
   1.172 +time_t mktime(struct tm *);
   1.173 +IMPORT_C 
   1.174 +size_t strftime(char * __restrict, size_t, const char * __restrict,
   1.175 +    const struct tm * __restrict);
   1.176 +IMPORT_C
   1.177 +time_t time(time_t *);
   1.178 +
   1.179 +#if __POSIX_VISIBLE
   1.180 +IMPORT_C
   1.181 +void tzset(void);
   1.182 +#endif
   1.183 +
   1.184 +#if __POSIX_VISIBLE >= 199309
   1.185 +IMPORT_C
   1.186 +int clock_getres(clockid_t, struct timespec *);
   1.187 +IMPORT_C
   1.188 +int clock_gettime(clockid_t, struct timespec *);
   1.189 +IMPORT_C
   1.190 +int clock_settime(clockid_t, const struct timespec *);
   1.191 +/* XXX missing: clock_nanosleep() */
   1.192 +IMPORT_C
   1.193 +int nanosleep(const struct timespec *, struct timespec *);
   1.194 +
   1.195 +//////////////////////////LIBRT: START/////////////////////////////////
   1.196 +
   1.197 +/* Create new per-process timer using CLOCK_ID.  */
   1.198 +IMPORT_C int timer_create (clockid_t __clock_id,
   1.199 +                         struct sigevent *__restrict __evp,
   1.200 +                         timer_t *__restrict __timerid);
   1.201 +
   1.202 +/* Delete timer TIMERID.  */
   1.203 +IMPORT_C int timer_delete (timer_t __timerid);
   1.204 +
   1.205 +/* Set timer TIMERID to VALUE, returning old value in OVLAUE.  */
   1.206 +IMPORT_C int timer_settime (timer_t __timerid, int __flags,
   1.207 +                          const struct itimerspec *__restrict __value,
   1.208 +                          struct itimerspec *__restrict __ovalue);
   1.209 +
   1.210 +/* Get current value of timer TIMERID and store it in VLAUE.  */
   1.211 +IMPORT_C int timer_gettime (timer_t __timerid, struct itimerspec *__value);
   1.212 +
   1.213 +/* Get expiration overrun for timer TIMERID.  */
   1.214 +IMPORT_C int timer_getoverrun (timer_t __timerid);
   1.215 +
   1.216 +IMPORT_C int clock_nanosleep(clockid_t clock_id, int flags,
   1.217 +       const struct timespec *rqtp, struct timespec *rmtp);
   1.218 +//////////////////////////LIBRT: END/////////////////////////////////
   1.219 +
   1.220 +#endif /* __POSIX_VISIBLE >= 199309 */
   1.221 +
   1.222 +#ifdef __SYMBIAN32__
   1.223 +IMPORT_C
   1.224 +int clock_getcpuclockid(pid_t , clockid_t *);
   1.225 +#endif //__SYMBIAN32__
   1.226 +
   1.227 +
   1.228 +#if __POSIX_VISIBLE >= 199506
   1.229 +IMPORT_C
   1.230 +char *asctime_r(const struct tm *, char *);
   1.231 +IMPORT_C
   1.232 +char *ctime_r(const time_t *, char *);
   1.233 +IMPORT_C
   1.234 +struct tm *gmtime_r(const time_t *, struct tm *);
   1.235 +IMPORT_C
   1.236 +struct tm *localtime_r(const time_t *, struct tm *);
   1.237 +#endif
   1.238 +
   1.239 +#if __XSI_VISIBLE
   1.240 +IMPORT_C 
   1.241 +char *strptime(const char * __restrict, const char * __restrict,
   1.242 +    struct tm * __restrict);
   1.243 +#endif
   1.244 +
   1.245 +#if __BSD_VISIBLE
   1.246 +char *timezone(int, int);	/* XXX XSI conflict */
   1.247 +#ifndef __SYMBIAN32__
   1.248 +void tzsetwall(void);
   1.249 +#endif //__SYMBIAN32__
   1.250 +time_t timelocal(struct tm * const);
   1.251 +IMPORT_C time_t timegm(struct tm * const);
   1.252 +#endif /* __BSD_VISIBLE */
   1.253 +__END_DECLS
   1.254 +
   1.255 +#endif /* !_TIME_H_ */