2009-03-04 04:28:35 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2008 The Android Open Source Project
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* * Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* * Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
|
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
|
|
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
2013-11-05 22:28:36 +01:00
|
|
|
|
2009-03-04 04:28:35 +01:00
|
|
|
#ifndef _TIME_H_
|
|
|
|
#define _TIME_H_
|
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
#include <sys/time.h>
|
2012-10-17 19:10:11 +02:00
|
|
|
|
2009-03-04 04:28:35 +01:00
|
|
|
__BEGIN_DECLS
|
|
|
|
|
2013-11-05 22:28:36 +01:00
|
|
|
#define CLOCKS_PER_SEC 1000000
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2013-11-05 22:28:36 +01:00
|
|
|
extern char* tzname[];
|
|
|
|
extern int daylight;
|
|
|
|
extern long int timezone;
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2013-11-07 21:28:46 +01:00
|
|
|
struct sigevent;
|
|
|
|
|
2009-03-04 04:28:35 +01:00
|
|
|
struct tm {
|
2013-11-05 22:28:36 +01:00
|
|
|
int tm_sec;
|
|
|
|
int tm_min;
|
|
|
|
int tm_hour;
|
|
|
|
int tm_mday;
|
|
|
|
int tm_mon;
|
|
|
|
int tm_year;
|
|
|
|
int tm_wday;
|
|
|
|
int tm_yday;
|
|
|
|
int tm_isdst;
|
|
|
|
long int tm_gmtoff;
|
|
|
|
const char* tm_zone;
|
2009-03-04 04:28:35 +01:00
|
|
|
};
|
|
|
|
|
2013-11-05 22:28:36 +01:00
|
|
|
#define TM_ZONE tm_zone
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2013-11-05 22:28:36 +01:00
|
|
|
extern time_t time(time_t*);
|
|
|
|
extern int nanosleep(const struct timespec*, struct timespec*);
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2013-11-05 22:28:36 +01:00
|
|
|
extern char* strtotimeval(const char*, struct timeval*);
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2013-11-05 22:28:36 +01:00
|
|
|
extern char* asctime(const struct tm*);
|
|
|
|
extern char* asctime_r(const struct tm*, char*);
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2013-11-05 22:28:36 +01:00
|
|
|
extern double difftime(time_t, time_t);
|
|
|
|
extern time_t mktime(struct tm*);
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2013-11-05 22:28:36 +01:00
|
|
|
extern struct tm* localtime(const time_t*);
|
|
|
|
extern struct tm* localtime_r(const time_t*, struct tm*);
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2013-11-05 22:28:36 +01:00
|
|
|
extern struct tm* gmtime(const time_t*);
|
|
|
|
extern struct tm* gmtime_r(const time_t*, struct tm*);
|
2009-03-19 06:20:24 +01:00
|
|
|
|
2013-11-05 22:28:36 +01:00
|
|
|
extern char* strptime(const char*, const char*, struct tm*);
|
|
|
|
extern size_t strftime(char*, size_t, const char*, const struct tm*);
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2013-11-05 22:28:36 +01:00
|
|
|
extern char* ctime(const time_t*);
|
|
|
|
extern char* ctime_r(const time_t*, char*);
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2013-11-05 22:28:36 +01:00
|
|
|
extern void tzset(void);
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2013-11-05 22:28:36 +01:00
|
|
|
extern clock_t clock(void);
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2013-11-05 22:28:36 +01:00
|
|
|
extern int clock_getres(int, struct timespec*);
|
|
|
|
extern int clock_gettime(int, struct timespec*);
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2013-11-05 22:28:36 +01:00
|
|
|
extern int timer_create(int, struct sigevent*, timer_t*);
|
|
|
|
extern int timer_delete(timer_t);
|
|
|
|
extern int timer_settime(timer_t, int, const struct itimerspec*, struct itimerspec*);
|
|
|
|
extern int timer_gettime(timer_t, struct itimerspec*);
|
|
|
|
extern int timer_getoverrun(timer_t);
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2013-11-05 22:28:36 +01:00
|
|
|
extern time_t timelocal(struct tm*);
|
|
|
|
extern time_t timegm(struct tm*);
|
|
|
|
extern time_t time2posix(time_t);
|
|
|
|
extern time_t posix2time(time_t);
|
2010-12-06 12:23:16 +01:00
|
|
|
|
2009-03-04 04:28:35 +01:00
|
|
|
__END_DECLS
|
|
|
|
|
|
|
|
#endif /* _TIME_H_ */
|