11dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/* 21dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Copyright (C) 2008 The Android Open Source Project 31dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * All rights reserved. 41dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 51dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Redistribution and use in source and binary forms, with or without 61dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * modification, are permitted provided that the following conditions 71dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * are met: 81dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * * Redistributions of source code must retain the above copyright 91dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * notice, this list of conditions and the following disclaimer. 101dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * * Redistributions in binary form must reproduce the above copyright 111dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * notice, this list of conditions and the following disclaimer in 121dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * the documentation and/or other materials provided with the 131dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * distribution. 141dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 151dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 161dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 171dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 181dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 191dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 201dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 211dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 221dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 231dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 241dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 251dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 261dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * SUCH DAMAGE. 271dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project */ 283503ce2177a56a8807887ee540abc68377483393Elliott Hughes 291dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#ifndef _TIME_H_ 301dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define _TIME_H_ 311dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 321dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#include <sys/cdefs.h> 331dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#include <sys/time.h> 34dfb5ce42bcc5a275af49211c0bbe64c5ec3d2668Dan Albert#include <xlocale.h> 35c1b44ecc5385e68e81667068e03b32c2084a85b1David 'Digit' Turner 361dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project__BEGIN_DECLS 371dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 383503ce2177a56a8807887ee540abc68377483393Elliott Hughes#define CLOCKS_PER_SEC 1000000 391dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 4006366724d572ef005f5bc0ddd8ad46794cbfad3bElliott Hughesextern char* tzname[] __LIBC_ABI_PUBLIC__; 4106366724d572ef005f5bc0ddd8ad46794cbfad3bElliott Hughesextern int daylight __LIBC_ABI_PUBLIC__; 4206366724d572ef005f5bc0ddd8ad46794cbfad3bElliott Hughesextern long int timezone __LIBC_ABI_PUBLIC__; 431dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 4461fb3fc770566c7bafe7af8fb93590bcad387fbbElliott Hughesstruct sigevent; 4561fb3fc770566c7bafe7af8fb93590bcad387fbbElliott Hughes 461dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Projectstruct tm { 473503ce2177a56a8807887ee540abc68377483393Elliott Hughes int tm_sec; 483503ce2177a56a8807887ee540abc68377483393Elliott Hughes int tm_min; 493503ce2177a56a8807887ee540abc68377483393Elliott Hughes int tm_hour; 503503ce2177a56a8807887ee540abc68377483393Elliott Hughes int tm_mday; 513503ce2177a56a8807887ee540abc68377483393Elliott Hughes int tm_mon; 523503ce2177a56a8807887ee540abc68377483393Elliott Hughes int tm_year; 533503ce2177a56a8807887ee540abc68377483393Elliott Hughes int tm_wday; 543503ce2177a56a8807887ee540abc68377483393Elliott Hughes int tm_yday; 553503ce2177a56a8807887ee540abc68377483393Elliott Hughes int tm_isdst; 563503ce2177a56a8807887ee540abc68377483393Elliott Hughes long int tm_gmtoff; 573503ce2177a56a8807887ee540abc68377483393Elliott Hughes const char* tm_zone; 581dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project}; 591dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 603503ce2177a56a8807887ee540abc68377483393Elliott Hughes#define TM_ZONE tm_zone 611dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 62d10db8261949e4d84b65f5c369153d0ca86ab22cElliott Hughesextern time_t time(time_t*) __LIBC_ABI_PUBLIC__; 63d10db8261949e4d84b65f5c369153d0ca86ab22cElliott Hughesextern int nanosleep(const struct timespec*, struct timespec*) __LIBC_ABI_PUBLIC__; 641dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 65d10db8261949e4d84b65f5c369153d0ca86ab22cElliott Hughesextern char* asctime(const struct tm*) __LIBC_ABI_PUBLIC__; 66d10db8261949e4d84b65f5c369153d0ca86ab22cElliott Hughesextern char* asctime_r(const struct tm*, char*) __LIBC_ABI_PUBLIC__; 671dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 68d10db8261949e4d84b65f5c369153d0ca86ab22cElliott Hughesextern double difftime(time_t, time_t) __LIBC_ABI_PUBLIC__; 69d10db8261949e4d84b65f5c369153d0ca86ab22cElliott Hughesextern time_t mktime(struct tm*) __LIBC_ABI_PUBLIC__; 701dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 71d10db8261949e4d84b65f5c369153d0ca86ab22cElliott Hughesextern struct tm* localtime(const time_t*) __LIBC_ABI_PUBLIC__; 72d10db8261949e4d84b65f5c369153d0ca86ab22cElliott Hughesextern struct tm* localtime_r(const time_t*, struct tm*) __LIBC_ABI_PUBLIC__; 731dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 74d10db8261949e4d84b65f5c369153d0ca86ab22cElliott Hughesextern struct tm* gmtime(const time_t*) __LIBC_ABI_PUBLIC__; 75d10db8261949e4d84b65f5c369153d0ca86ab22cElliott Hughesextern struct tm* gmtime_r(const time_t*, struct tm*) __LIBC_ABI_PUBLIC__; 76edbe7fc97bab7ff0684053d1be564330689bf3adThe Android Open Source Project 77d10db8261949e4d84b65f5c369153d0ca86ab22cElliott Hughesextern char* strptime(const char*, const char*, struct tm*) __LIBC_ABI_PUBLIC__; 78d10db8261949e4d84b65f5c369153d0ca86ab22cElliott Hughesextern size_t strftime(char*, size_t, const char*, const struct tm*) __LIBC_ABI_PUBLIC__; 79dfb5ce42bcc5a275af49211c0bbe64c5ec3d2668Dan Albertextern size_t strftime_l(char *, size_t, const char *, const struct tm *, locale_t) __LIBC_ABI_PUBLIC__; 801dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 81d10db8261949e4d84b65f5c369153d0ca86ab22cElliott Hughesextern char* ctime(const time_t*) __LIBC_ABI_PUBLIC__; 82d10db8261949e4d84b65f5c369153d0ca86ab22cElliott Hughesextern char* ctime_r(const time_t*, char*) __LIBC_ABI_PUBLIC__; 831dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 84d10db8261949e4d84b65f5c369153d0ca86ab22cElliott Hughesextern void tzset(void) __LIBC_ABI_PUBLIC__; 851dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 86d10db8261949e4d84b65f5c369153d0ca86ab22cElliott Hughesextern clock_t clock(void) __LIBC_ABI_PUBLIC__; 871dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 88d5c652756bb1a52959cd5c62447b62462f90f983Yabin Cuiextern int clock_getcpuclockid(pid_t, clockid_t*) __LIBC_ABI_PUBLIC__; 89d5c652756bb1a52959cd5c62447b62462f90f983Yabin Cui 9018160256840e9bb097f17422ea47d54fabbc9f3fHaruki Hasegawaextern int clock_getres(clockid_t, struct timespec*) __LIBC_ABI_PUBLIC__; 9118160256840e9bb097f17422ea47d54fabbc9f3fHaruki Hasegawaextern int clock_gettime(clockid_t, struct timespec*) __LIBC_ABI_PUBLIC__; 9218160256840e9bb097f17422ea47d54fabbc9f3fHaruki Hasegawaextern int clock_nanosleep(clockid_t, int, const struct timespec*, struct timespec*) __LIBC_ABI_PUBLIC__; 9318160256840e9bb097f17422ea47d54fabbc9f3fHaruki Hasegawaextern int clock_settime(clockid_t, const struct timespec*) __LIBC_ABI_PUBLIC__; 941dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 95d10db8261949e4d84b65f5c369153d0ca86ab22cElliott Hughesextern int timer_create(int, struct sigevent*, timer_t*) __LIBC_ABI_PUBLIC__; 96d10db8261949e4d84b65f5c369153d0ca86ab22cElliott Hughesextern int timer_delete(timer_t) __LIBC_ABI_PUBLIC__; 97d10db8261949e4d84b65f5c369153d0ca86ab22cElliott Hughesextern int timer_settime(timer_t, int, const struct itimerspec*, struct itimerspec*) __LIBC_ABI_PUBLIC__; 98d10db8261949e4d84b65f5c369153d0ca86ab22cElliott Hughesextern int timer_gettime(timer_t, struct itimerspec*) __LIBC_ABI_PUBLIC__; 99d10db8261949e4d84b65f5c369153d0ca86ab22cElliott Hughesextern int timer_getoverrun(timer_t) __LIBC_ABI_PUBLIC__; 1001dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 101d10db8261949e4d84b65f5c369153d0ca86ab22cElliott Hughes/* Non-standard extensions that are in the BSDs and glibc. */ 102d10db8261949e4d84b65f5c369153d0ca86ab22cElliott Hughesextern time_t timelocal(struct tm*) __LIBC_ABI_PUBLIC__; 103d10db8261949e4d84b65f5c369153d0ca86ab22cElliott Hughesextern time_t timegm(struct tm*) __LIBC_ABI_PUBLIC__; 1046481b91520150e9664a3c4abc5d2aebdce422f93David 'Digit' Turner 1051dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project__END_DECLS 1061dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 1071dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif /* _TIME_H_ */ 108