time.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1989, 1993
00003  *      The Regents of the University of California.  All rights reserved.
00004  * (c) UNIX System Laboratories, Inc.
00005  * All or some portions of this file are derived from material licensed
00006  * to the University of California by American Telephone and Telegraph
00007  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
00008  * the permission of UNIX System Laboratories, Inc.
00009  *
00010  * Redistribution and use in source and binary forms, with or without
00011  * modification, are permitted provided that the following conditions
00012  * are met:
00013  * 1. Redistributions of source code must retain the above copyright
00014  *    notice, this list of conditions and the following disclaimer.
00015  * 2. Redistributions in binary form must reproduce the above copyright
00016  *    notice, this list of conditions and the following disclaimer in the
00017  *    documentation and/or other materials provided with the distribution.
00018  * 3. All advertising materials mentioning features or use of this software
00019  *    must display the following acknowledgement:
00020  *      This product includes software developed by the University of
00021  *      California, Berkeley and its contributors.
00022  * 4. Neither the name of the University nor the names of its contributors
00023  *    may be used to endorse or promote products derived from this software
00024  *    without specific prior written permission.
00025  *
00026  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00027  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00028  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00029  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00030  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00031  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00032  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00033  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00034  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00035  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00036  * SUCH DAMAGE.
00037  *
00038  *      @(#)time.h      8.3 (Berkeley) 1/21/94
00039  * © Portions copyright (c) 2005-2006 Nokia Corporation.  All rights reserved.
00040  */
00041 
00042 /*
00043  * $FreeBSD: src/include/time.h,v 1.32 2005/04/02 12:33:27 das Exp $
00044  */
00045 
00046 #ifndef _TIME_H_
00047 #define _TIME_H_
00048 
00049 #include <sys/cdefs.h>
00050 #include <sys/_null.h>
00051 #include <sys/_types.h>
00052 #ifdef __SYMBIAN32__
00053 #include <sys/types.h>
00054 #endif
00055 
00056 #if __POSIX_VISIBLE > 0 && __POSIX_VISIBLE < 200112 || __BSD_VISIBLE
00057 /*
00058  * Frequency of the clock ticks reported by times().  Deprecated - use
00059  * sysconf(_SC_CLK_TCK) instead.  (Removed in 1003.1-2001.)
00060  */
00061 #ifdef __SYMBIAN32__
00062 #define CLK_TCK         128
00063 //__SYMBIAN32__
00064 #endif
00065 #endif
00066 
00067 /* Frequency of the clock ticks reported by clock().  */
00068 #ifndef __SYMBIAN32__
00069 #define CLOCKS_PER_SEC  128
00070 //__SYMBIAN32__
00071 #endif
00072 
00073 #ifndef _CLOCK_T_DECLARED
00074 typedef __clock_t       clock_t;
00075 #define _CLOCK_T_DECLARED
00076 #endif
00077 
00078 #ifndef _TIME_T_DECLARED
00079 typedef __time_t        time_t;
00080 #define _TIME_T_DECLARED
00081 #endif
00082 
00083 #ifndef _SIZE_T_DECLARED
00084 typedef __size_t        size_t;
00085 #define _SIZE_T_DECLARED
00086 #endif
00087 
00088 #if __POSIX_VISIBLE >= 199309
00089 /*
00090  * New in POSIX 1003.1b-1993.
00091  */
00092 #ifndef _CLOCKID_T_DECLARED
00093 typedef __clockid_t     clockid_t;
00094 #define _CLOCKID_T_DECLARED
00095 #endif
00096 
00097 #ifndef _TIMER_T_DECLARED
00098 typedef __timer_t       timer_t;
00099 #define _TIMER_T_DECLARED
00100 #endif
00101 
00102 #include <sys/timespec.h>
00103 #endif /* __POSIX_VISIBLE >= 199309 */
00104 
00105 /* These macros are also in sys/time.h. */
00106 #if !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112
00107 #define CLOCK_REALTIME  0
00108 #ifdef __BSD_VISIBLE
00109 #define CLOCK_VIRTUAL   1
00110 #define CLOCK_PROF      2
00111 #endif
00112 #define CLOCK_MONOTONIC 4
00113 #endif /* !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112 */
00114 
00115 #if !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 200112
00116 #if __BSD_VISIBLE
00117 #define TIMER_RELTIME   0x0     /* relative timer */
00118 #endif
00119 #define TIMER_ABSTIME   0x1     /* absolute timer */
00120 #endif /* !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 200112 */
00121 
00122 struct tm {
00123         int     tm_sec;         /* seconds after the minute [0-60] */
00124         int     tm_min;         /* minutes after the hour [0-59] */
00125         int     tm_hour;        /* hours since midnight [0-23] */
00126         int     tm_mday;        /* day of the month [1-31] */
00127         int     tm_mon;         /* months since January [0-11] */
00128         int     tm_year;        /* years since 1900 */
00129         int     tm_wday;        /* days since Sunday [0-6] */
00130         int     tm_yday;        /* days since January 1 [0-365] */
00131         int     tm_isdst;       /* Daylight Savings Time flag */
00132         long    tm_gmtoff;      /* offset from UTC in seconds */
00133         char    *tm_zone;       /* timezone abbreviation */
00134 };
00135 
00136 #if __POSIX_VISIBLE
00137 extern char *tzname[];
00138 #endif
00139 
00140 __BEGIN_DECLS
00141 IMPORT_C
00142 char *asctime(const struct tm *);
00143 IMPORT_C
00144 clock_t clock(void);
00145 IMPORT_C
00146 char *ctime(const time_t *);
00147 IMPORT_C
00148 double difftime(time_t, time_t);
00149 /* XXX missing: getdate() */
00150 IMPORT_C
00151 struct tm *gmtime(const time_t *);
00152 IMPORT_C
00153 struct tm *localtime(const time_t *);
00154 IMPORT_C
00155 time_t mktime(struct tm *);
00156 IMPORT_C
00157 size_t strftime(char * __restrict, size_t, const char * __restrict,
00158     const struct tm * __restrict);
00159 IMPORT_C
00160 time_t time(time_t *);
00161 
00162 #if __POSIX_VISIBLE
00163 IMPORT_C
00164 void tzset(void);
00165 #endif
00166 
00167 #if __POSIX_VISIBLE >= 199309
00168 IMPORT_C
00169 int clock_getres(clockid_t, struct timespec *);
00170 IMPORT_C
00171 int clock_gettime(clockid_t, struct timespec *);
00172 IMPORT_C
00173 int clock_settime(clockid_t, const struct timespec *);
00174 /* XXX missing: clock_nanosleep() */
00175 IMPORT_C
00176 int nanosleep(const struct timespec *, struct timespec *);
00177 #endif /* __POSIX_VISIBLE >= 199309 */
00178 
00179 #ifdef __SYMBIAN32__
00180 IMPORT_C
00181 int clock_getcpuclockid(pid_t , clockid_t *);
00182 //__SYMBIAN32__
00183 #endif
00184 
00185 
00186 #if __POSIX_VISIBLE >= 199506
00187 IMPORT_C
00188 char *asctime_r(const struct tm *, char *);
00189 IMPORT_C
00190 char *ctime_r(const time_t *, char *);
00191 IMPORT_C
00192 struct tm *gmtime_r(const time_t *, struct tm *);
00193 IMPORT_C
00194 struct tm *localtime_r(const time_t *, struct tm *);
00195 #endif
00196 
00197 #if __XSI_VISIBLE
00198 IMPORT_C
00199 char *strptime(const char * __restrict, const char * __restrict,
00200     struct tm * __restrict);
00201 #endif
00202 
00203 #if __BSD_VISIBLE
00204 char *timezone(int, int);       /* XXX XSI conflict */
00205 void tzsetwall(void);
00206 time_t timelocal(struct tm * const);
00207 IMPORT_C time_t timegm(struct tm * const);
00208 #endif /* __BSD_VISIBLE */
00209 __END_DECLS
00210 
00211 #endif /* !_TIME_H_ */

Copyright © Nokia Corporation 2001-2008
Back to top