epoc32/include/stdapis/time.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
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@2
    35
 * © Portions copyright (c) 2005-2006 Nokia Corporation.  All rights reserved.
williamr@2
    36
 * © Portions copyright (c) 2008 Symbian Software Ltd. All rights reserved.
williamr@2
    37
 */
williamr@2
    38
williamr@2
    39
/*
williamr@2
    40
 * $FreeBSD: src/include/time.h,v 1.32 2005/04/02 12:33:27 das Exp $
williamr@2
    41
 */
williamr@2
    42
williamr@2
    43
#ifndef _TIME_H_
williamr@2
    44
#define	_TIME_H_
williamr@2
    45
williamr@2
    46
#include <sys/cdefs.h>
williamr@2
    47
#include <sys/_null.h>
williamr@2
    48
#include <sys/_types.h>
williamr@2
    49
#ifdef __SYMBIAN32__
williamr@2
    50
#include <sys/types.h>
williamr@2
    51
#endif
williamr@2
    52
williamr@2
    53
#if __POSIX_VISIBLE > 0 && __POSIX_VISIBLE < 200112 || __BSD_VISIBLE
williamr@2
    54
/*
williamr@2
    55
 * Frequency of the clock ticks reported by times().  Deprecated - use
williamr@2
    56
 * sysconf(_SC_CLK_TCK) instead.  (Removed in 1003.1-2001.)
williamr@2
    57
 */
williamr@2
    58
#ifdef __SYMBIAN32__
williamr@2
    59
#define	CLK_TCK		128
williamr@2
    60
#endif //__SYMBIAN32__
williamr@2
    61
#endif
williamr@2
    62
williamr@2
    63
/* Frequency of the clock ticks reported by clock().  */
williamr@2
    64
#ifndef __SYMBIAN32__
williamr@2
    65
#define	CLOCKS_PER_SEC	128
williamr@2
    66
#endif //__SYMBIAN32__
williamr@2
    67
williamr@2
    68
#ifndef _CLOCK_T_DECLARED
williamr@2
    69
typedef	__clock_t	clock_t;
williamr@2
    70
#define	_CLOCK_T_DECLARED
williamr@2
    71
#endif
williamr@2
    72
williamr@2
    73
#ifndef _TIME_T_DECLARED
williamr@2
    74
typedef	__time_t	time_t;
williamr@2
    75
#define	_TIME_T_DECLARED
williamr@2
    76
#endif
williamr@2
    77
williamr@2
    78
#ifndef _SIZE_T_DECLARED
williamr@2
    79
typedef	__size_t	size_t;
williamr@2
    80
#define	_SIZE_T_DECLARED
williamr@2
    81
#endif
williamr@2
    82
williamr@2
    83
#if __POSIX_VISIBLE >= 199309
williamr@2
    84
/*
williamr@2
    85
 * New in POSIX 1003.1b-1993.
williamr@2
    86
 */
williamr@2
    87
#ifndef _CLOCKID_T_DECLARED
williamr@2
    88
typedef	__clockid_t	clockid_t;
williamr@2
    89
#define	_CLOCKID_T_DECLARED
williamr@2
    90
#endif
williamr@2
    91
williamr@2
    92
#ifndef _TIMER_T_DECLARED
williamr@2
    93
typedef	__timer_t	timer_t;
williamr@2
    94
#define	_TIMER_T_DECLARED
williamr@2
    95
#endif
williamr@2
    96
williamr@2
    97
#include <sys/timespec.h>
williamr@2
    98
#endif /* __POSIX_VISIBLE >= 199309 */
williamr@2
    99
williamr@2
   100
/* These macros are also in sys/time.h. */
williamr@2
   101
#if !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112
williamr@2
   102
#define CLOCK_REALTIME	0
williamr@2
   103
#ifdef __BSD_VISIBLE
williamr@2
   104
#define CLOCK_VIRTUAL	1
williamr@2
   105
#define CLOCK_PROF	2
williamr@2
   106
#endif
williamr@2
   107
#define CLOCK_MONOTONIC	4
williamr@2
   108
#endif /* !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112 */
williamr@2
   109
williamr@2
   110
#if !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 200112
williamr@2
   111
#if __BSD_VISIBLE
williamr@2
   112
#define TIMER_RELTIME	0x0	/* relative timer */
williamr@2
   113
#endif
williamr@2
   114
#define TIMER_ABSTIME	0x1	/* absolute timer */
williamr@2
   115
#endif /* !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 200112 */
williamr@2
   116
williamr@2
   117
struct tm {
williamr@2
   118
	int	tm_sec;		/* seconds after the minute [0-60] */
williamr@2
   119
	int	tm_min;		/* minutes after the hour [0-59] */
williamr@2
   120
	int	tm_hour;	/* hours since midnight [0-23] */
williamr@2
   121
	int	tm_mday;	/* day of the month [1-31] */
williamr@2
   122
	int	tm_mon;		/* months since January [0-11] */
williamr@2
   123
	int	tm_year;	/* years since 1900 */
williamr@2
   124
	int	tm_wday;	/* days since Sunday [0-6] */
williamr@2
   125
	int	tm_yday;	/* days since January 1 [0-365] */
williamr@2
   126
	int	tm_isdst;	/* Daylight Savings Time flag */
williamr@2
   127
	long	tm_gmtoff;	/* offset from UTC in seconds */
williamr@2
   128
	char	*tm_zone;	/* timezone abbreviation */
williamr@2
   129
};
williamr@2
   130
williamr@2
   131
#if __POSIX_VISIBLE
williamr@2
   132
extern char *tzname[];
williamr@2
   133
#endif
williamr@2
   134
williamr@2
   135
__BEGIN_DECLS
williamr@2
   136
#ifdef __SYMBIAN32__
williamr@2
   137
IMPORT_C char*** __tzname(void);
williamr@2
   138
#define	tzname		(*__tzname())
williamr@2
   139
#endif //__SYMBIAN32__
williamr@2
   140
williamr@2
   141
IMPORT_C
williamr@2
   142
char *asctime(const struct tm *);
williamr@2
   143
IMPORT_C
williamr@2
   144
clock_t clock(void);
williamr@2
   145
IMPORT_C
williamr@2
   146
char *ctime(const time_t *);
williamr@2
   147
IMPORT_C
williamr@2
   148
double difftime(time_t, time_t);
williamr@2
   149
/* XXX missing: getdate() */
williamr@2
   150
IMPORT_C
williamr@2
   151
struct tm *gmtime(const time_t *);
williamr@2
   152
IMPORT_C
williamr@2
   153
struct tm *localtime(const time_t *);
williamr@2
   154
IMPORT_C
williamr@2
   155
time_t mktime(struct tm *);
williamr@2
   156
IMPORT_C 
williamr@2
   157
size_t strftime(char * __restrict, size_t, const char * __restrict,
williamr@2
   158
    const struct tm * __restrict);
williamr@2
   159
IMPORT_C
williamr@2
   160
time_t time(time_t *);
williamr@2
   161
williamr@2
   162
#if __POSIX_VISIBLE
williamr@2
   163
IMPORT_C
williamr@2
   164
void tzset(void);
williamr@2
   165
#endif
williamr@2
   166
williamr@2
   167
#if __POSIX_VISIBLE >= 199309
williamr@2
   168
IMPORT_C
williamr@2
   169
int clock_getres(clockid_t, struct timespec *);
williamr@2
   170
IMPORT_C
williamr@2
   171
int clock_gettime(clockid_t, struct timespec *);
williamr@2
   172
IMPORT_C
williamr@2
   173
int clock_settime(clockid_t, const struct timespec *);
williamr@2
   174
/* XXX missing: clock_nanosleep() */
williamr@2
   175
IMPORT_C
williamr@2
   176
int nanosleep(const struct timespec *, struct timespec *);
williamr@2
   177
#endif /* __POSIX_VISIBLE >= 199309 */
williamr@2
   178
williamr@2
   179
#ifdef __SYMBIAN32__
williamr@2
   180
IMPORT_C
williamr@2
   181
int clock_getcpuclockid(pid_t , clockid_t *);
williamr@2
   182
#endif //__SYMBIAN32__
williamr@2
   183
williamr@2
   184
williamr@2
   185
#if __POSIX_VISIBLE >= 199506
williamr@2
   186
IMPORT_C
williamr@2
   187
char *asctime_r(const struct tm *, char *);
williamr@2
   188
IMPORT_C
williamr@2
   189
char *ctime_r(const time_t *, char *);
williamr@2
   190
IMPORT_C
williamr@2
   191
struct tm *gmtime_r(const time_t *, struct tm *);
williamr@2
   192
IMPORT_C
williamr@2
   193
struct tm *localtime_r(const time_t *, struct tm *);
williamr@2
   194
#endif
williamr@2
   195
williamr@2
   196
#if __XSI_VISIBLE
williamr@2
   197
IMPORT_C 
williamr@2
   198
char *strptime(const char * __restrict, const char * __restrict,
williamr@2
   199
    struct tm * __restrict);
williamr@2
   200
#endif
williamr@2
   201
williamr@2
   202
#if __BSD_VISIBLE
williamr@2
   203
char *timezone(int, int);	/* XXX XSI conflict */
williamr@2
   204
#ifndef __SYMBIAN32__
williamr@2
   205
void tzsetwall(void);
williamr@2
   206
#endif //__SYMBIAN32__
williamr@2
   207
time_t timelocal(struct tm * const);
williamr@2
   208
IMPORT_C time_t timegm(struct tm * const);
williamr@2
   209
#endif /* __BSD_VISIBLE */
williamr@2
   210
__END_DECLS
williamr@2
   211
williamr@2
   212
#endif /* !_TIME_H_ */