Home | History | Annotate | Download | only in posix
      1 /*
      2  * Copyright (C) 2017 The Android Open Source Project
      3  * All rights reserved.
      4  *
      5  * Redistribution and use in source and binary forms, with or without
      6  * modification, are permitted provided that the following conditions
      7  * are met:
      8  *  * Redistributions of source code must retain the above copyright
      9  *    notice, this list of conditions and the following disclaimer.
     10  *  * Redistributions in binary form must reproduce the above copyright
     11  *    notice, this list of conditions and the following disclaimer in
     12  *    the documentation and/or other materials provided with the
     13  *    distribution.
     14  *
     15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
     18  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
     19  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
     20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     21  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
     22  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
     23  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     24  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
     25  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     26  * SUCH DAMAGE.
     27  */
     28 
     29 #if !defined(DO_NOT_INCLUDE_TIME_H)
     30 #include <time.h>
     31 #endif
     32 
     33 #include "header_checks.h"
     34 
     35 static void time_h() {
     36   TYPE(clock_t);
     37   TYPE(size_t);
     38   TYPE(time_t);
     39 
     40   TYPE(clockid_t);
     41   TYPE(timer_t);
     42 
     43   TYPE(locale_t);
     44 
     45   TYPE(pid_t);
     46 
     47   TYPE(struct tm);
     48   STRUCT_MEMBER(struct tm, int, tm_sec);
     49   STRUCT_MEMBER(struct tm, int, tm_min);
     50   STRUCT_MEMBER(struct tm, int, tm_hour);
     51   STRUCT_MEMBER(struct tm, int, tm_mday);
     52   STRUCT_MEMBER(struct tm, int, tm_mon);
     53   STRUCT_MEMBER(struct tm, int, tm_year);
     54   STRUCT_MEMBER(struct tm, int, tm_wday);
     55   STRUCT_MEMBER(struct tm, int, tm_yday);
     56   STRUCT_MEMBER(struct tm, int, tm_isdst);
     57 
     58   TYPE(struct timespec);
     59   STRUCT_MEMBER(struct timespec, time_t, tv_sec);
     60   STRUCT_MEMBER(struct timespec, long, tv_nsec);
     61 
     62   TYPE(struct itimerspec);
     63   STRUCT_MEMBER(struct itimerspec, struct timespec, it_interval);
     64   STRUCT_MEMBER(struct itimerspec, struct timespec, it_value);
     65 
     66   MACRO(NULL);
     67   MACRO(CLOCKS_PER_SEC);
     68 
     69   MACRO(CLOCK_MONOTONIC);
     70   MACRO(CLOCK_PROCESS_CPUTIME_ID);
     71   MACRO(CLOCK_REALTIME);
     72   MACRO(CLOCK_THREAD_CPUTIME_ID);
     73 
     74   MACRO(TIMER_ABSTIME);
     75 
     76   FUNCTION(asctime, char* (*f)(const struct tm*));
     77   FUNCTION(asctime_r, char* (*f)(const struct tm*, char*));
     78   FUNCTION(clock, clock_t (*f)(void));
     79   FUNCTION(clock_getcpuclockid, int (*f)(pid_t, clockid_t*));
     80   FUNCTION(clock_getres, int (*f)(clockid_t, struct timespec*));
     81   FUNCTION(clock_gettime, int (*f)(clockid_t, struct timespec*));
     82   FUNCTION(clock_nanosleep, int (*f)(clockid_t, int, const struct timespec*, struct timespec*));
     83   FUNCTION(clock_settime, int (*f)(clockid_t, const struct timespec*));
     84   FUNCTION(ctime, char* (*f)(const time_t*));
     85   FUNCTION(ctime_r, char* (*f)(const time_t*, char*));
     86   FUNCTION(difftime, double (*f)(time_t, time_t));
     87 #if !defined(__BIONIC__)
     88   FUNCTION(getdate, struct tm* (*f)(const char*));
     89 #endif
     90   FUNCTION(gmtime, struct tm* (*f)(const time_t*));
     91   FUNCTION(gmtime_r, struct tm* (*f)(const time_t*, struct tm*));
     92   FUNCTION(localtime, struct tm* (*f)(const time_t*));
     93   FUNCTION(localtime_r, struct tm* (*f)(const time_t*, struct tm*));
     94   FUNCTION(mktime, time_t (*f)(struct tm*));
     95   FUNCTION(nanosleep, int (*f)(const struct timespec*, struct timespec*));
     96   FUNCTION(strftime, size_t (*f)(char*, size_t, const char*, const struct tm*));
     97   FUNCTION(strftime_l, size_t (*f)(char*, size_t, const char*, const struct tm*, locale_t));
     98   FUNCTION(strptime, char* (*f)(const char*, const char*, struct tm*));
     99   FUNCTION(time, time_t (*f)(time_t*));
    100   FUNCTION(timer_create, int (*f)(clockid_t, struct sigevent*, timer_t*));
    101   FUNCTION(timer_delete, int (*f)(timer_t));
    102   FUNCTION(timer_getoverrun, int (*f)(timer_t));
    103   FUNCTION(timer_gettime, int (*f)(timer_t, struct itimerspec*));
    104   FUNCTION(timer_settime, int (*f)(timer_t, int, const struct itimerspec*, struct itimerspec*));
    105   FUNCTION(tzset, void (*f)(void));
    106 
    107   int i = daylight;
    108   long l = timezone;
    109   char** sp = tzname;
    110 }
    111