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