os/ossrv/genericopenlibs/openenvcore/include/time.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
 * Copyright (c) 1989, 1993
sl@0
     3
 *	The Regents of the University of California.  All rights reserved.
sl@0
     4
 * (c) UNIX System Laboratories, Inc.
sl@0
     5
 * All or some portions of this file are derived from material licensed
sl@0
     6
 * to the University of California by American Telephone and Telegraph
sl@0
     7
 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
sl@0
     8
 * the permission of UNIX System Laboratories, Inc.
sl@0
     9
 *
sl@0
    10
 * Redistribution and use in source and binary forms, with or without
sl@0
    11
 * modification, are permitted provided that the following conditions
sl@0
    12
 * are met:
sl@0
    13
 * 1. Redistributions of source code must retain the above copyright
sl@0
    14
 *    notice, this list of conditions and the following disclaimer.
sl@0
    15
 * 2. Redistributions in binary form must reproduce the above copyright
sl@0
    16
 *    notice, this list of conditions and the following disclaimer in the
sl@0
    17
 *    documentation and/or other materials provided with the distribution.
sl@0
    18
 * 4. Neither the name of the University nor the names of its contributors
sl@0
    19
 *    may be used to endorse or promote products derived from this software
sl@0
    20
 *    without specific prior written permission.
sl@0
    21
 *
sl@0
    22
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
sl@0
    23
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
sl@0
    24
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
sl@0
    25
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
sl@0
    26
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
sl@0
    27
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
sl@0
    28
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
sl@0
    29
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
sl@0
    30
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
sl@0
    31
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
sl@0
    32
 * SUCH DAMAGE.
sl@0
    33
 *
sl@0
    34
 *	@(#)time.h	8.3 (Berkeley) 1/21/94
sl@0
    35
 * © Portions Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
sl@0
    36
 */
sl@0
    37
sl@0
    38
/*
sl@0
    39
 * $FreeBSD: src/include/time.h,v 1.32 2005/04/02 12:33:27 das Exp $
sl@0
    40
 */
sl@0
    41
sl@0
    42
#ifndef _TIME_H_
sl@0
    43
#define	_TIME_H_
sl@0
    44
sl@0
    45
#include <sys/cdefs.h>
sl@0
    46
#include <sys/_null.h>
sl@0
    47
#include <sys/_types.h>
sl@0
    48
#ifdef __SYMBIAN32__
sl@0
    49
#include <sys/types.h>
sl@0
    50
#endif
sl@0
    51
sl@0
    52
#if __POSIX_VISIBLE > 0 && __POSIX_VISIBLE < 200112 || __BSD_VISIBLE
sl@0
    53
/*
sl@0
    54
 * Frequency of the clock ticks reported by times().  Deprecated - use
sl@0
    55
 * sysconf(_SC_CLK_TCK) instead.  (Removed in 1003.1-2001.)
sl@0
    56
 */
sl@0
    57
#ifdef __SYMBIAN32__
sl@0
    58
#define	CLK_TCK		128
sl@0
    59
#endif //__SYMBIAN32__
sl@0
    60
#endif
sl@0
    61
sl@0
    62
/* Frequency of the clock ticks reported by clock().  */
sl@0
    63
#ifndef __SYMBIAN32__
sl@0
    64
#define	CLOCKS_PER_SEC	128
sl@0
    65
#endif //__SYMBIAN32__
sl@0
    66
sl@0
    67
#ifndef _CLOCK_T_DECLARED
sl@0
    68
typedef	__clock_t	clock_t;
sl@0
    69
#define	_CLOCK_T_DECLARED
sl@0
    70
#endif
sl@0
    71
sl@0
    72
#ifndef _TIME_T_DECLARED
sl@0
    73
typedef	__time_t	time_t;
sl@0
    74
#define	_TIME_T_DECLARED
sl@0
    75
#endif
sl@0
    76
sl@0
    77
#ifndef _SIZE_T_DECLARED
sl@0
    78
typedef	__size_t	size_t;
sl@0
    79
#define	_SIZE_T_DECLARED
sl@0
    80
#endif
sl@0
    81
sl@0
    82
#if __POSIX_VISIBLE >= 199309
sl@0
    83
/*
sl@0
    84
 * New in POSIX 1003.1b-1993.
sl@0
    85
 */
sl@0
    86
#ifndef _CLOCKID_T_DECLARED
sl@0
    87
typedef	__clockid_t	clockid_t;
sl@0
    88
#define	_CLOCKID_T_DECLARED
sl@0
    89
#endif
sl@0
    90
sl@0
    91
#ifndef _TIMER_T_DECLARED
sl@0
    92
typedef	__timer_t	timer_t;
sl@0
    93
#define	_TIMER_T_DECLARED
sl@0
    94
#endif
sl@0
    95
sl@0
    96
#include <sys/timespec.h>
sl@0
    97
sl@0
    98
/* POSIX.1b structure for timer start values and intervals.  */
sl@0
    99
struct itimerspec
sl@0
   100
  {
sl@0
   101
    struct timespec it_interval;
sl@0
   102
    struct timespec it_value;
sl@0
   103
  };
sl@0
   104
sl@0
   105
/* We can use a simple forward declaration.  */
sl@0
   106
struct sigevent; 
sl@0
   107
#endif /* __POSIX_VISIBLE >= 199309 */
sl@0
   108
sl@0
   109
/* These macros are also in sys/time.h. */
sl@0
   110
#if !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112
sl@0
   111
#define CLOCK_REALTIME	0
sl@0
   112
#ifdef __BSD_VISIBLE
sl@0
   113
#define CLOCK_VIRTUAL	1
sl@0
   114
#define CLOCK_PROF	2
sl@0
   115
#endif
sl@0
   116
#define CLOCK_MONOTONIC	4
sl@0
   117
#endif /* !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112 */
sl@0
   118
sl@0
   119
#if !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 200112
sl@0
   120
#if __BSD_VISIBLE
sl@0
   121
#define TIMER_RELTIME	0x0	/* relative timer */
sl@0
   122
#endif
sl@0
   123
#define TIMER_ABSTIME	0x1	/* absolute timer */
sl@0
   124
#endif /* !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 200112 */
sl@0
   125
sl@0
   126
struct tm {
sl@0
   127
	int	tm_sec;		/* seconds after the minute [0-60] */
sl@0
   128
	int	tm_min;		/* minutes after the hour [0-59] */
sl@0
   129
	int	tm_hour;	/* hours since midnight [0-23] */
sl@0
   130
	int	tm_mday;	/* day of the month [1-31] */
sl@0
   131
	int	tm_mon;		/* months since January [0-11] */
sl@0
   132
	int	tm_year;	/* years since 1900 */
sl@0
   133
	int	tm_wday;	/* days since Sunday [0-6] */
sl@0
   134
	int	tm_yday;	/* days since January 1 [0-365] */
sl@0
   135
	int	tm_isdst;	/* Daylight Savings Time flag */
sl@0
   136
	long	tm_gmtoff;	/* offset from UTC in seconds */
sl@0
   137
	char	*tm_zone;	/* timezone abbreviation */
sl@0
   138
};
sl@0
   139
sl@0
   140
#if __POSIX_VISIBLE
sl@0
   141
extern char *tzname[];
sl@0
   142
#endif
sl@0
   143
sl@0
   144
__BEGIN_DECLS
sl@0
   145
#ifdef __SYMBIAN32__
sl@0
   146
#ifdef __WINSCW__
sl@0
   147
#ifndef __SOFTFP
sl@0
   148
#define __SOFTFP
sl@0
   149
#endif /* __SOFTFP */
sl@0
   150
#endif//__WINSCW__
sl@0
   151
IMPORT_C char*** __tzname(void);
sl@0
   152
#define	tzname		(*__tzname())
sl@0
   153
#endif //__SYMBIAN32__
sl@0
   154
sl@0
   155
IMPORT_C
sl@0
   156
char *asctime(const struct tm *);
sl@0
   157
IMPORT_C
sl@0
   158
clock_t clock(void);
sl@0
   159
IMPORT_C
sl@0
   160
char *ctime(const time_t *);
sl@0
   161
IMPORT_C
sl@0
   162
double difftime(time_t, time_t) __SOFTFP;
sl@0
   163
/* XXX missing: getdate() */
sl@0
   164
IMPORT_C
sl@0
   165
struct tm *gmtime(const time_t *);
sl@0
   166
IMPORT_C
sl@0
   167
struct tm *localtime(const time_t *);
sl@0
   168
IMPORT_C
sl@0
   169
time_t mktime(struct tm *);
sl@0
   170
IMPORT_C 
sl@0
   171
size_t strftime(char * __restrict, size_t, const char * __restrict,
sl@0
   172
    const struct tm * __restrict);
sl@0
   173
IMPORT_C
sl@0
   174
time_t time(time_t *);
sl@0
   175
sl@0
   176
#if __POSIX_VISIBLE
sl@0
   177
IMPORT_C
sl@0
   178
void tzset(void);
sl@0
   179
#endif
sl@0
   180
sl@0
   181
#if __POSIX_VISIBLE >= 199309
sl@0
   182
IMPORT_C
sl@0
   183
int clock_getres(clockid_t, struct timespec *);
sl@0
   184
IMPORT_C
sl@0
   185
int clock_gettime(clockid_t, struct timespec *);
sl@0
   186
IMPORT_C
sl@0
   187
int clock_settime(clockid_t, const struct timespec *);
sl@0
   188
/* XXX missing: clock_nanosleep() */
sl@0
   189
IMPORT_C
sl@0
   190
int nanosleep(const struct timespec *, struct timespec *);
sl@0
   191
sl@0
   192
//////////////////////////LIBRT: START/////////////////////////////////
sl@0
   193
sl@0
   194
/* Create new per-process timer using CLOCK_ID.  */
sl@0
   195
IMPORT_C int timer_create (clockid_t __clock_id,
sl@0
   196
                         struct sigevent *__restrict __evp,
sl@0
   197
                         timer_t *__restrict __timerid);
sl@0
   198
sl@0
   199
/* Delete timer TIMERID.  */
sl@0
   200
IMPORT_C int timer_delete (timer_t __timerid);
sl@0
   201
sl@0
   202
/* Set timer TIMERID to VALUE, returning old value in OVLAUE.  */
sl@0
   203
IMPORT_C int timer_settime (timer_t __timerid, int __flags,
sl@0
   204
                          const struct itimerspec *__restrict __value,
sl@0
   205
                          struct itimerspec *__restrict __ovalue);
sl@0
   206
sl@0
   207
/* Get current value of timer TIMERID and store it in VLAUE.  */
sl@0
   208
IMPORT_C int timer_gettime (timer_t __timerid, struct itimerspec *__value);
sl@0
   209
sl@0
   210
/* Get expiration overrun for timer TIMERID.  */
sl@0
   211
IMPORT_C int timer_getoverrun (timer_t __timerid);
sl@0
   212
sl@0
   213
IMPORT_C int clock_nanosleep(clockid_t clock_id, int flags,
sl@0
   214
       const struct timespec *rqtp, struct timespec *rmtp);
sl@0
   215
//////////////////////////LIBRT: END/////////////////////////////////
sl@0
   216
sl@0
   217
#endif /* __POSIX_VISIBLE >= 199309 */
sl@0
   218
sl@0
   219
#ifdef __SYMBIAN32__
sl@0
   220
IMPORT_C
sl@0
   221
int clock_getcpuclockid(pid_t , clockid_t *);
sl@0
   222
#endif //__SYMBIAN32__
sl@0
   223
sl@0
   224
sl@0
   225
#if __POSIX_VISIBLE >= 199506
sl@0
   226
IMPORT_C
sl@0
   227
char *asctime_r(const struct tm *, char *);
sl@0
   228
IMPORT_C
sl@0
   229
char *ctime_r(const time_t *, char *);
sl@0
   230
IMPORT_C
sl@0
   231
struct tm *gmtime_r(const time_t *, struct tm *);
sl@0
   232
IMPORT_C
sl@0
   233
struct tm *localtime_r(const time_t *, struct tm *);
sl@0
   234
#endif
sl@0
   235
sl@0
   236
#if __XSI_VISIBLE
sl@0
   237
IMPORT_C 
sl@0
   238
char *strptime(const char * __restrict, const char * __restrict,
sl@0
   239
    struct tm * __restrict);
sl@0
   240
#endif
sl@0
   241
sl@0
   242
#if __BSD_VISIBLE
sl@0
   243
char *timezone(int, int);	/* XXX XSI conflict */
sl@0
   244
#ifndef __SYMBIAN32__
sl@0
   245
void tzsetwall(void);
sl@0
   246
#endif //__SYMBIAN32__
sl@0
   247
time_t timelocal(struct tm * const);
sl@0
   248
IMPORT_C time_t timegm(struct tm * const);
sl@0
   249
#endif /* __BSD_VISIBLE */
sl@0
   250
__END_DECLS
sl@0
   251
sl@0
   252
#endif /* !_TIME_H_ */