121b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes/*
221b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * Copyright (C) 2017 The Android Open Source Project
321b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * All rights reserved.
421b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes *
521b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * Redistribution and use in source and binary forms, with or without
621b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * modification, are permitted provided that the following conditions
721b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * are met:
821b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes *  * Redistributions of source code must retain the above copyright
921b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes *    notice, this list of conditions and the following disclaimer.
1021b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes *  * Redistributions in binary form must reproduce the above copyright
1121b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes *    notice, this list of conditions and the following disclaimer in
1221b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes *    the documentation and/or other materials provided with the
1321b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes *    distribution.
1421b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes *
1521b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1621b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1721b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
1821b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
1921b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
2021b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
2121b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
2221b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
2321b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2421b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
2521b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2621b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes * SUCH DAMAGE.
2721b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes */
2821b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes
2921b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes#if !defined(DO_NOT_INCLUDE_TIME_H)
3021b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes#include <time.h>
3121b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes#endif
3221b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes
3321b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes#include "header_checks.h"
3421b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes
3521b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughesstatic void time_h() {
3621b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  TYPE(clock_t);
3721b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  TYPE(size_t);
3821b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  TYPE(time_t);
3921b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes
4021b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  TYPE(clockid_t);
4121b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  TYPE(timer_t);
4221b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes
4321b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  TYPE(locale_t);
4421b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes
4521b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  TYPE(pid_t);
4621b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes
4721b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  TYPE(struct tm);
4821b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  STRUCT_MEMBER(struct tm, int, tm_sec);
4921b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  STRUCT_MEMBER(struct tm, int, tm_min);
5021b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  STRUCT_MEMBER(struct tm, int, tm_hour);
5121b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  STRUCT_MEMBER(struct tm, int, tm_mday);
5221b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  STRUCT_MEMBER(struct tm, int, tm_mon);
5321b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  STRUCT_MEMBER(struct tm, int, tm_year);
5421b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  STRUCT_MEMBER(struct tm, int, tm_wday);
5521b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  STRUCT_MEMBER(struct tm, int, tm_yday);
5621b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  STRUCT_MEMBER(struct tm, int, tm_isdst);
5721b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes
5821b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  TYPE(struct timespec);
5921b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  STRUCT_MEMBER(struct timespec, time_t, tv_sec);
6021b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  STRUCT_MEMBER(struct timespec, long, tv_nsec);
6121b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes
6221b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  TYPE(struct itimerspec);
6321b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  STRUCT_MEMBER(struct itimerspec, struct timespec, it_interval);
6421b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  STRUCT_MEMBER(struct itimerspec, struct timespec, it_value);
6521b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes
6621b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  MACRO(NULL);
6721b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  MACRO(CLOCKS_PER_SEC);
6821b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes
6921b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  MACRO(CLOCK_MONOTONIC);
7021b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  MACRO(CLOCK_PROCESS_CPUTIME_ID);
7121b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  MACRO(CLOCK_REALTIME);
7221b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  MACRO(CLOCK_THREAD_CPUTIME_ID);
7321b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes
7421b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  MACRO(TIMER_ABSTIME);
7521b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes
7621b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(asctime, char* (*f)(const struct tm*));
7721b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(asctime_r, char* (*f)(const struct tm*, char*));
7821b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(clock, clock_t (*f)(void));
7921b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(clock_getcpuclockid, int (*f)(pid_t, clockid_t*));
8021b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(clock_getres, int (*f)(clockid_t, struct timespec*));
8121b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(clock_gettime, int (*f)(clockid_t, struct timespec*));
8221b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(clock_nanosleep, int (*f)(clockid_t, int, const struct timespec*, struct timespec*));
8321b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(clock_settime, int (*f)(clockid_t, const struct timespec*));
8421b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(ctime, char* (*f)(const time_t*));
8521b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(ctime_r, char* (*f)(const time_t*, char*));
8621b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(difftime, double (*f)(time_t, time_t));
8721b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes#if !defined(__BIONIC__)
8821b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(getdate, struct tm* (*f)(const char*));
8921b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes#endif
9021b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(gmtime, struct tm* (*f)(const time_t*));
9121b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(gmtime_r, struct tm* (*f)(const time_t*, struct tm*));
9221b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(localtime, struct tm* (*f)(const time_t*));
9321b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(localtime_r, struct tm* (*f)(const time_t*, struct tm*));
9421b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(mktime, time_t (*f)(struct tm*));
9521b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(nanosleep, int (*f)(const struct timespec*, struct timespec*));
9621b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(strftime, size_t (*f)(char*, size_t, const char*, const struct tm*));
9721b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(strftime_l, size_t (*f)(char*, size_t, const char*, const struct tm*, locale_t));
9821b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(strptime, char* (*f)(const char*, const char*, struct tm*));
9921b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(time, time_t (*f)(time_t*));
10021b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(timer_create, int (*f)(clockid_t, struct sigevent*, timer_t*));
10121b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(timer_delete, int (*f)(timer_t));
10221b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(timer_getoverrun, int (*f)(timer_t));
10321b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(timer_gettime, int (*f)(timer_t, struct itimerspec*));
10421b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(timer_settime, int (*f)(timer_t, int, const struct itimerspec*, struct itimerspec*));
10521b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  FUNCTION(tzset, void (*f)(void));
10621b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes
10721b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  int i = daylight;
10821b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  long l = timezone;
10921b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes  char** sp = tzname;
11021b56ebbd49362d293e1f56c4b3265c227bbbbaeElliott Hughes}
111