Changeset 657


Ignore:
Timestamp:
Sep 7, 2003, 9:23:15 PM (22 years ago)
Author:
bird
Message:

Up to FreeBSD 5.1 level.

Location:
trunk/src/emx/include
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/include/emx/thread.h

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r656 r657  
    88#endif
    99
    10 #if !defined (_TM)
    11 #define _TM
    12 struct tm         /* cf. <time.h> */
    13 {
    14   int tm_sec;     /* 0..59 */
    15   int tm_min;     /* 0..59 */
    16   int tm_hour;    /* 0..23 */
    17   int tm_mday;    /* 1..31 */
    18   int tm_mon;     /* 0..11 */
    19   int tm_year;    /* 0(:=1900).. */
    20   int tm_wday;    /* 0..6 */
    21   int tm_yday;    /* 0..365 */
    22   int tm_isdst;   /* 0 */
    23 };
    24 #endif
     10#include <time.h> /* struct tm; */
    2511
    2612struct _uheap;
  • trunk/src/emx/include/sys/time.h

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r656 r657  
    1 /* - modified for gcc/os2 by bird 2003
    2  *
     1/*
    32 * Copyright (c) 1982, 1986, 1993
    43 *      The Regents of the University of California.  All rights reserved.
     
    3332 *
    3433 *      @(#)time.h      8.5 (Berkeley) 5/4/95
    35   */
     34 * $FreeBSD: src/sys/sys/time.h,v 1.61 2003/02/23 10:18:31 phk Exp $
     35 */
     36
     37/** @file
     38 * FreeBSD 5.1
     39 *
     40 * @changed EMX isms
     41 * @changed IBM TCP paranoia.
     42 */
    3643
    3744#ifndef _SYS_TIME_H_
    3845#define _SYS_TIME_H_
    3946
    40 #include <time.h>
     47#include <sys/_timeval.h>
    4148#include <sys/types.h>
    42 
    43 #if defined (__cplusplus)
    44 extern "C" {
    45 #endif
    46 
    47 #if !defined (_TIMEVAL)
    48 #define _TIMEVAL
    49 /** gettimeofday return structure */
    50 struct timeval
    51 {
    52   /** seconds */
    53   long tv_sec;
    54   /** and microseconds */
    55   long tv_usec;
     49#include <sys/timespec.h>
     50
     51#if !defined (_TIMEZONE)                /* bird: EMX */
     52#define _TIMEZONE                       /* bird: EMX */
     53struct timezone {
     54        int     tz_minuteswest; /* minutes west of Greenwich */
     55        int     tz_dsttime;     /* type of dst correction */
    5656};
    57 #endif
    58 
    59 #if !defined (_TIMEZONE)
    60 #define _TIMEZONE
    61 /** Timezone information */
    62 struct timezone
    63 {
    64   /** minutes west of Greenwich */
    65   int tz_minuteswest;
    66   /** type of dst correction. */
    67   int tz_dsttime;
     57#endif                                  /* bird: EMX */
     58#define DST_NONE        0       /* not on dst */
     59#define DST_USA         1       /* USA style dst */
     60#define DST_AUST        2       /* Australian style dst */
     61#define DST_WET         3       /* Western European dst */
     62#define DST_MET         4       /* Middle European dst */
     63#define DST_EET         5       /* Eastern European dst */
     64#define DST_CAN         6       /* Canada */
     65
     66#if __BSD_VISIBLE
     67struct bintime {
     68        time_t  sec;
     69        uint64_t frac;
    6870};
    69 #endif
    70 
    71 #if !defined(TCPV40HDRS) && !defined(DST_NONE)
    72 #define DST_NONE    0   /* not on dst */
    73 #define DST_USA     1   /* USA style dst. */
    74 #define DST_AUST    2   /* Australian style dst. */
    75 #define DST_WET     3   /* Western European dst. */
    76 #define DST_MET     4   /* Middle European dst. */
    77 #define DST_EET     5   /* Eastern European dst. */
    78 #define DST_CAN     6   /* Canada. */
    79 #endif  /* !TCPV40HDRS */
    80 
    81 #ifndef TCPV40HDRS
    82 #pragma pack(4)
    83 /** POSIX.4 version of timeval. */
    84 struct timespec {
    85         time_t  ts_sec;         /* seconds */
    86         long    ts_nsec;        /* and nanoseconds */
    87 };
    88 #pragma pack()
    89 #define TIMEVAL_TO_TIMESPEC(tv, ts) {                                   \
    90         (ts)->ts_sec = (tv)->tv_sec;                                    \
    91         (ts)->ts_nsec = (tv)->tv_usec * 1000;                           \
    92 }
    93 #define TIMESPEC_TO_TIMEVAL(tv, ts) {                                   \
    94         (tv)->tv_sec = (ts)->ts_sec;                                    \
    95         (tv)->tv_usec = (ts)->ts_nsec / 1000;                           \
    96 }
     71
     72static __inline void
     73bintime_addx(struct bintime *bt, uint64_t x)
     74{
     75        uint64_t u;
     76
     77        u = bt->frac;
     78        bt->frac += x;
     79        if (u > bt->frac)
     80                bt->sec++;
     81}
     82
     83static __inline void
     84bintime_add(struct bintime *bt, struct bintime *bt2)
     85{
     86        uint64_t u;
     87
     88        u = bt->frac;
     89        bt->frac += bt2->frac;
     90        if (u > bt->frac)
     91                bt->sec++;
     92        bt->sec += bt2->sec;
     93}
     94
     95static __inline void
     96bintime_sub(struct bintime *bt, struct bintime *bt2)
     97{
     98        uint64_t u;
     99
     100        u = bt->frac;
     101        bt->frac -= bt2->frac;
     102        if (u < bt->frac)
     103                bt->sec--;
     104        bt->sec -= bt2->sec;
     105}
     106
     107/*-
     108 * Background information:
     109 *
     110 * When converting between timestamps on parallel timescales of differing
     111 * resolutions it is historical and scientific practice to round down rather
     112 * than doing 4/5 rounding.
     113 *
     114 *   The date changes at midnight, not at noon.
     115 *
     116 *   Even at 15:59:59.999999999 it's not four'o'clock.
     117 *
     118 *   time_second ticks after N.999999999 not after N.4999999999
     119 */
     120
     121static __inline void
     122bintime2timespec(struct bintime *bt, struct timespec *ts)
     123{
     124
     125        ts->tv_sec = bt->sec;
     126        ts->tv_nsec = ((uint64_t)1000000000 * (uint32_t)(bt->frac >> 32)) >> 32;
     127}
     128
     129static __inline void
     130timespec2bintime(struct timespec *ts, struct bintime *bt)
     131{
     132
     133        bt->sec = ts->tv_sec;
     134        /* 18446744073 = int(2^64 / 1000000000) */
     135        bt->frac = ts->tv_nsec * (uint64_t)18446744073LL;
     136}
     137
     138static __inline void
     139bintime2timeval(struct bintime *bt, struct timeval *tv)
     140{
     141
     142        tv->tv_sec = bt->sec;
     143        tv->tv_usec = ((uint64_t)1000000 * (uint32_t)(bt->frac >> 32)) >> 32;
     144}
     145
     146static __inline void
     147timeval2bintime(struct timeval *tv, struct bintime *bt)
     148{
     149
     150        bt->sec = tv->tv_sec;
     151        /* 18446744073709 = int(2^64 / 1000000) */
     152        bt->frac = tv->tv_usec * (uint64_t)18446744073709LL;
     153}
     154#endif /* __BSD_VISIBLE */
     155
     156#ifdef _KERNEL
     157
     158/* Operations on timespecs */
     159#define timespecclear(tvp)      ((tvp)->tv_sec = (tvp)->tv_nsec = 0)
     160#define timespecisset(tvp)      ((tvp)->tv_sec || (tvp)->tv_nsec)
     161#define timespeccmp(tvp, uvp, cmp)                                      \
     162        (((tvp)->tv_sec == (uvp)->tv_sec) ?                             \
     163            ((tvp)->tv_nsec cmp (uvp)->tv_nsec) :                       \
     164            ((tvp)->tv_sec cmp (uvp)->tv_sec))
     165#define timespecadd(vvp, uvp)                                           \
     166        do {                                                            \
     167                (vvp)->tv_sec += (uvp)->tv_sec;                         \
     168                (vvp)->tv_nsec += (uvp)->tv_nsec;                       \
     169                if ((vvp)->tv_nsec >= 1000000000) {                     \
     170                        (vvp)->tv_sec++;                                \
     171                        (vvp)->tv_nsec -= 1000000000;                   \
     172                }                                                       \
     173        } while (0)
     174#define timespecsub(vvp, uvp)                                           \
     175        do {                                                            \
     176                (vvp)->tv_sec -= (uvp)->tv_sec;                         \
     177                (vvp)->tv_nsec -= (uvp)->tv_nsec;                       \
     178                if ((vvp)->tv_nsec < 0) {                               \
     179                        (vvp)->tv_sec--;                                \
     180                        (vvp)->tv_nsec += 1000000000;                   \
     181                }                                                       \
     182        } while (0)
    97183
    98184/* Operations on timevals. */
    99 #define timerclear(tvp)         ((tvp)->tv_sec = (tvp)->tv_usec = 0)
    100 #define timerisset(tvp)         ((tvp)->tv_sec || (tvp)->tv_usec)
    101 #ifndef timercmp
    102 #define timercmp(tvp, uvp, cmp)                                         \
    103         (((tvp)->tv_sec == (uvp)->tv_sec) ?                             \
    104             ((tvp)->tv_usec cmp (uvp)->tv_usec) :                       \
    105             ((tvp)->tv_sec cmp (uvp)->tv_sec))
    106 #endif
    107 #ifndef timeradd
     185
     186#define timevalclear(tvp)               ((tvp)->tv_sec = (tvp)->tv_usec = 0)
     187#define timevalisset(tvp)               ((tvp)->tv_sec || (tvp)->tv_usec)
     188#define timevalcmp(tvp, uvp, cmp)                                       \
     189        (((tvp)->tv_sec == (uvp)->tv_sec) ?                             \
     190            ((tvp)->tv_usec cmp (uvp)->tv_usec) :                       \
     191            ((tvp)->tv_sec cmp (uvp)->tv_sec))
     192
     193/* timevaladd and timevalsub are not inlined */
     194
     195#endif /* _KERNEL */
     196
     197#ifndef _KERNEL                 /* NetBSD/OpenBSD compatible interfaces */
     198
     199#define timerclear(tvp)         ((tvp)->tv_sec = (tvp)->tv_usec = 0)
     200#define timerisset(tvp)         ((tvp)->tv_sec || (tvp)->tv_usec)
     201#ifndef timercmp    /* bird: TCP paranoia */
     202#define timercmp(tvp, uvp, cmp)                                 \
     203        (((tvp)->tv_sec == (uvp)->tv_sec) ?                             \
     204            ((tvp)->tv_usec cmp (uvp)->tv_usec) :                       \
     205            ((tvp)->tv_sec cmp (uvp)->tv_sec))
     206#endif              /* bird: TCP paranoia */
     207#ifndef timeradd    /* bird: TCP paranoia */
    108208#define timeradd(tvp, uvp, vvp)                                         \
    109209        do {                                                            \
     
    115215                }                                                       \
    116216        } while (0)
    117 #endif
    118 #ifdef timersub
     217#endif              /* bird: TCP paranoia */
     218#ifndef timersub    /* bird: TCP paranoia */
    119219#define timersub(tvp, uvp, vvp)                                         \
    120220        do {                                                            \
     
    126226                }                                                       \
    127227        } while (0)
    128 #endif
    129 
    130 /*
    131  * Getkerninfo clock information structure
    132  */
    133 struct clockinfo {
    134         int     hz;             /* clock frequency */
    135         int     tick;           /* micro-seconds per hz tick */
    136         int     stathz;         /* statistics clock frequency */
    137         int     profhz;         /* profiling clock frequency */
    138 };
     228#endif              /* bird: TCP paranoia */
     229#endif
    139230
    140231/*
     
    142233 * defining a timer setting.
    143234 */
    144 #define ITIMER_REAL     0
    145 #define ITIMER_VIRTUAL  1
    146 #define ITIMER_PROF     2
    147 #endif /* !TCPV40HDRS */
    148 
    149 #pragma pack(4)
    150 struct  itimerval {
    151         struct  timeval it_interval;    /* timer interval */
    152         struct  timeval it_value;       /* current value */
     235#define ITIMER_REAL     0
     236#define ITIMER_VIRTUAL  1
     237#define ITIMER_PROF     2
     238
     239#pragma pack(4) /* bird: IBM TCP paranoia */
     240struct itimerval {
     241        struct  timeval it_interval;    /* timer interval */
     242        struct  timeval it_value;       /* current value */
    153243};
    154 #pragma pack()
    155 
    156 
    157 #if defined(TCPV40HDRS) || !defined(_POSIX_SOURCE)
    158 /* These are libc functions so no _System convention. */
    159 int     utimes (__const__ char *, __const__ struct timeval *);
    160 int     gettimeofday (struct timeval *, struct timezone *);
    161 int     settimeofday (__const__ struct timeval *, __const__ struct timezone *);
    162 
    163 #ifndef TCPV40HDRS
     244#pragma pack()  /* bird: IBM TCP paranoia */
     245
     246/*
     247 * Getkerninfo clock information structure
     248 */
     249struct clockinfo {
     250        int     hz;             /* clock frequency */
     251        int     tick;           /* micro-seconds per hz tick */
     252#if 0  /* bird: OS/2 TCP doesn't define this. */
     253        int     spare;
     254#endif
     255        int     stathz;         /* statistics clock frequency */
     256        int     profhz;         /* profiling clock frequency */
     257};
     258
     259/* CLOCK_REALTIME and TIMER_ABSTIME are supposed to be in time.h */
     260
     261#ifndef CLOCK_REALTIME
     262#define CLOCK_REALTIME  0
     263#endif
     264#define CLOCK_VIRTUAL   1
     265#define CLOCK_PROF      2
     266#define CLOCK_MONOTONIC 4
     267
     268#define TIMER_RELTIME   0x0     /* relative timer */
     269#ifndef TIMER_ABSTIME
     270#define TIMER_ABSTIME   0x1     /* absolute timer */
     271#endif
     272
     273#ifdef _KERNEL
     274extern time_t   time_second;
     275extern time_t   time_uptime;
     276
     277/*
     278 * Functions for looking at our clock: [get]{bin,nano,micro}[up]time()
     279 *
     280 * Functions without the "get" prefix returns the best timestamp
     281 * we can produce in the given format.
     282 *
     283 * "bin"   == struct bintime  == seconds + 64 bit fraction of seconds.
     284 * "nano"  == struct timespec == seconds + nanoseconds.
     285 * "micro" == struct timeval  == seconds + microseconds.
     286 *
     287 * Functions containing "up" returns time relative to boot and
     288 * should be used for calculating time intervals.
     289 *
     290 * Functions without "up" returns GMT time.
     291 *
     292 * Functions with the "get" prefix returns a less precise result
     293 * much faster than the functions without "get" prefix and should
     294 * be used where a precision of 10 msec is acceptable or where
     295 * performance is priority. (NB: "precision", _not_ "resolution" !)
     296 *
     297 */
     298
     299void    binuptime(struct bintime *bt);
     300void    nanouptime(struct timespec *tsp);
     301void    microuptime(struct timeval *tvp);
     302
     303void    bintime(struct bintime *bt);
     304void    nanotime(struct timespec *tsp);
     305void    microtime(struct timeval *tvp);
     306
     307void    getbinuptime(struct bintime *bt);
     308void    getnanouptime(struct timespec *tsp);
     309void    getmicrouptime(struct timeval *tvp);
     310
     311void    getbintime(struct bintime *bt);
     312void    getnanotime(struct timespec *tsp);
     313void    getmicrotime(struct timeval *tvp);
     314
     315/* Other functions */
     316int     itimerdecr(struct itimerval *itp, int usec);
     317int     itimerfix(struct timeval *tv);
     318int     ppsratecheck(struct timeval *, int *, int);
     319int     ratecheck(struct timeval *, const struct timeval *);
     320void    timevaladd(struct timeval *t1, struct timeval *t2);
     321void    timevalsub(struct timeval *t1, struct timeval *t2);
     322int     tvtohz(struct timeval *tv);
     323#else /* !_KERNEL */
     324#include <time.h>
     325
    164326#include <sys/cdefs.h>
    165327
     328__BEGIN_DECLS
     329/*int   adjtime(const struct timeval *, struct timeval *); bird: TCP */
     330int     futimes(int, const struct timeval *);
     331/*int   getitimer(int, struct itimerval *); bird: TCP */
     332int     gettimeofday(struct timeval *, struct timezone *);
     333int     lutimes(const char *, const struct timeval *);
     334/*int   setitimer(int, const struct itimerval *, struct itimerval *); bird: TCP */
     335int     settimeofday(const struct timeval *, const struct timezone *);
     336int     utimes(const char *, const struct timeval *);
     337
     338/* bird: TCP, moved some protos from above and down here. */
     339#if !defined(TCPV40HDRS)
    166340#ifndef TCPCALL
    167341#define TCPCALL _System
    168342#endif
    169 
    170 int     TCPCALL adjtime(const struct timeval *, struct timeval *);
    171 int     TCPCALL getitimer(int, struct itimerval *);
    172 int     TCPCALL setitimer(int, const struct itimerval *, struct itimerval *);
    173 #endif
     343int     TCPCALL setitimer(int, const struct itimerval *, struct itimerval *);
     344int     TCPCALL adjtime(const struct timeval *, struct timeval *);
     345int     TCPCALL getitimer(int, struct itimerval *);
    174346#endif /* TCPV40HDRS */
    175 
    176 
    177 #if defined (__cplusplus)
    178 }
    179 #endif
    180 
    181 #endif /* not _SYS_TIME_H_ */
     347/* bird: TCP end */
     348__END_DECLS
     349
     350#endif /* !_KERNEL */
     351
     352#endif /* !_SYS_TIME_H_ */
  • trunk/src/emx/include/time.h

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r656 r657  
    1 /* time.h (emx+gcc) */
    2 
    3 #ifndef _TIME_H
    4 #define _TIME_H
    5 
    6 #if defined (__cplusplus)
    7 extern "C" {
    8 #endif
    9 
    10 #if !defined (_SIZE_T)
    11 #define _SIZE_T
    12 typedef unsigned long size_t;
    13 #endif
    14 
    15 #if !defined (NULL)
    16 #if defined (__cplusplus)
    17 #define NULL 0
    18 #else
    19 #define NULL ((void *)0)
    20 #endif
    21 #endif
    22 
    23 #if !defined (_TIME_T)
    24 #define _TIME_T
    25 typedef unsigned long time_t;
    26 #endif
    27 
    28 #if !defined (_CLOCK_T)
    29 #define _CLOCK_T
    30 typedef long clock_t;
    31 #endif
    32 
    33 #if !defined (_TM)
    34 #define _TM
    35 struct tm         /* cf. <emx/thread.h> */
    36 {
    37   int tm_sec;     /* 0..59 */
    38   int tm_min;     /* 0..59 */
    39   int tm_hour;    /* 0..23 */
    40   int tm_mday;    /* 1..31 */
    41   int tm_mon;     /* 0..11 */
    42   int tm_year;    /* 0(:=1900).. */
    43   int tm_wday;    /* 0..6 */
    44   int tm_yday;    /* 0..365 */
    45   int tm_isdst;   /* 0 */
     1/*
     2 * Copyright (c) 1989, 1993
     3 *      The Regents of the University of California.  All rights reserved.
     4 * (c) UNIX System Laboratories, Inc.
     5 * All or some portions of this file are derived from material licensed
     6 * to the University of California by American Telephone and Telegraph
     7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
     8 * the permission of UNIX System Laboratories, Inc.
     9 *
     10 * Redistribution and use in source and binary forms, with or without
     11 * modification, are permitted provided that the following conditions
     12 * are met:
     13 * 1. Redistributions of source code must retain the above copyright
     14 *    notice, this list of conditions and the following disclaimer.
     15 * 2. Redistributions in binary form must reproduce the above copyright
     16 *    notice, this list of conditions and the following disclaimer in the
     17 *    documentation and/or other materials provided with the distribution.
     18 * 3. All advertising materials mentioning features or use of this software
     19 *    must display the following acknowledgement:
     20 *      This product includes software developed by the University of
     21 *      California, Berkeley and its contributors.
     22 * 4. Neither the name of the University nor the names of its contributors
     23 *    may be used to endorse or promote products derived from this software
     24 *    without specific prior written permission.
     25 *
     26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     29 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     36 * SUCH DAMAGE.
     37 *
     38 *      @(#)time.h      8.3 (Berkeley) 1/21/94
     39 */
     40
     41/*
     42 * $FreeBSD: src/include/time.h,v 1.30 2002/09/06 11:23:32 tjr Exp $
     43 */
     44
     45/** @file
     46 * FreeBSD 5.1
     47 *
     48 * @changed EMX isms.
     49 * @changed Removed timezone() function as it clashes with the timezone
     50 *          variable defined in EMX and OGBSI6.
     51 * @changed Changed CLK_TCK and CLOCKS_PER_SEC to 100.
     52 * @changed Commented out tm_gmtoff and tm_zone in struct tm as LIBC doesn't
     53 *          implement these yet.
     54 *
     55 * @todo    Implement tm_gmtoff and tm_zone members in struct tm.
     56 * @todo    Implement clock_getres(), clock_gettime(), clock_settime(), nanosleep().
     57 *          asctime_r(), ctime_r(), gmtime_r() and localtime_r() which are defined in
     58 *          various POSIX standard revisions.
     59 * @todo    Implement tzsetwall(), timelocal(), timegm() which are BSD specific.
     60 */
     61
     62#ifndef _TIME_H_
     63#define _TIME_H_
     64#define _TIME_H                         /* bird: EMX */
     65
     66#include <sys/cdefs.h>
     67#include <sys/_types.h>
     68
     69#if __POSIX_VISIBLE > 0 && __POSIX_VISIBLE < 200112 || __BSD_VISIBLE
     70/*
     71 * Frequency of the clock ticks reported by times().  Deprecated - use
     72 * sysconf(_SC_CLK_TCK) instead.  (Removed in 1003.1-2001.)
     73 */
     74#define CLK_TCK         100             /* bird: EMX uses 100, FreeBSD 128. */
     75#endif
     76
     77/* Frequency of the clock ticks reported by clock().  */
     78#define CLOCKS_PER_SEC  100             /* bird: EMX uses 100, FreeBSD 128. */
     79
     80#ifndef NULL
     81#define NULL    0
     82#endif
     83
     84#if !defined(_CLOCK_T_DECLARED) && !defined(_CLOCK_T) /* bird: EMX */
     85typedef __clock_t       clock_t;
     86#define _CLOCK_T_DECLARED
     87#define _CLOCK_T                        /* bird: EMX */
     88#endif
     89
     90#if !defined(_TIME_T_DECLARED) && !defined(_TIME_T) /* bird: EMX */
     91typedef __time_t        time_t;
     92#define _TIME_T_DECLARED
     93#define _TIME_T                         /* bird: EMX */
     94#endif
     95
     96#if !defined(_SIZE_T_DECLARED) && !defined(_SIZE_T) /* bird: EMX */
     97typedef __size_t        size_t;
     98#define _SIZE_T_DECLARED
     99#define _SIZE_T                         /* bird: EMX */
     100#endif
     101
     102#if __POSIX_VISIBLE >= 199309
     103/*
     104 * New in POSIX 1003.1b-1993.
     105 */
     106#if !defined(_CLOCKID_T_DECLARED) && !defined(_CLOCKID_T) /* bird: EMX */
     107typedef __clockid_t     clockid_t;
     108#define _CLOCKID_T_DECLARED
     109#define _CLOCKID_T                      /* bird: EMX */
     110#endif
     111
     112#if !defined(_TIMER_T_DECLARED) && !defined(_TIMER_T) /* bird: EMX */
     113typedef __timer_t       timer_t;
     114#define _TIMER_T_DECLARED
     115#define _TIMER_T                        /* bird: EMX */
     116#endif
     117
     118#include <sys/timespec.h>
     119#endif /* __POSIX_VISIBLE >= 199309 */
     120
     121struct tm {
     122        int     tm_sec;         /* seconds after the minute [0-60] */
     123        int     tm_min;         /* minutes after the hour [0-59] */
     124        int     tm_hour;        /* hours since midnight [0-23] */
     125        int     tm_mday;        /* day of the month [1-31] */
     126        int     tm_mon;         /* months since January [0-11] */
     127        int     tm_year;        /* years since 1900 */
     128        int     tm_wday;        /* days since Sunday [0-6] */
     129        int     tm_yday;        /* days since January 1 [0-365] */
     130        int     tm_isdst;       /* Daylight Savings Time flag */
     131#if 0 /* bird: LIBC isn't implementing tm_gmtoff and tm_zone. */
     132        long    tm_gmtoff;      /* offset from UTC in seconds */
     133        char    *tm_zone;       /* timezone abbreviation */
     134#endif
    46135};
    47 #endif
    48 
    49 #if !defined (CLOCKS_PER_SEC)
    50 #define CLOCKS_PER_SEC 100
    51 #endif
    52 
    53 char *asctime (__const__ struct tm *);
    54 char *ctime (__const__ time_t *);
    55 clock_t clock (void);
    56 double difftime (time_t, time_t);
    57 struct tm *gmtime (__const__ time_t *);
    58 struct tm *localtime (__const__ time_t *);
    59 time_t mktime (struct tm *);
    60 size_t strftime (char *, size_t, __const__ char *, __const__ struct tm *);
    61 time_t time (time_t *);
    62 
    63 
    64 #if !defined (__STRICT_ANSI__)
    65 
    66 /* POSIX.1 */
    67 
    68 void tzset (void);
    69 
    70 #endif
    71 
    72 
    73 #if !defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)
    74 
    75 #if !defined (CLK_TCK)
    76 #define CLK_TCK 100
    77 #endif
    78 
     136
     137#if __POSIX_VISIBLE
     138extern char *tzname[];
     139#endif
     140
     141__BEGIN_DECLS
     142char *asctime(const struct tm *);
     143clock_t clock(void);
     144char *ctime(const time_t *);
     145double difftime(time_t, time_t);
     146struct tm *gmtime(const time_t *);
     147struct tm *localtime(const time_t *);
     148time_t mktime(struct tm *);
     149size_t strftime(char * __restrict, size_t, const char * __restrict,
     150    const struct tm * __restrict);
     151time_t time(time_t *);
     152
     153#if __POSIX_VISIBLE
     154void tzset(void);
     155#endif
     156
     157#if __POSIX_VISIBLE >= 199309
     158int clock_getres(clockid_t, struct timespec *);
     159int clock_gettime(clockid_t, struct timespec *);
     160int clock_settime(clockid_t, const struct timespec *);
     161int nanosleep(const struct timespec *, struct timespec *);
     162#endif /* __POSIX_VISIBLE >= 199309 */
     163
     164#if __POSIX_VISIBLE >= 199506
     165char *asctime_r(const struct tm *, char *);
     166char *ctime_r(const time_t *, char *);
     167struct tm *gmtime_r(const time_t *, struct tm *);
     168struct tm *localtime_r(const time_t *, struct tm *);
     169#endif
     170
     171#if __XSI_VISIBLE
     172char *strptime(const char * __restrict, const char * __restrict,
     173    struct tm * __restrict);
     174#endif
     175
     176#if __BSD_VISIBLE
     177/* bird: clash with EMX (and OGBSI6) timezone is a variable. man page say this
     178 * is for Unix version 7 compatability though...
     179char *timezone(int, int); */
     180void tzsetwall(void);
     181time_t timelocal(struct tm * const);
     182time_t timegm(struct tm * const);
     183#endif /* __BSD_VISIBLE */
     184
     185/* bird: LIBC OGBSI6 compliance extras. */
     186#if __POSIX_VISIBLE
    79187extern int daylight;
    80188extern long timezone;
    81 extern char *tzname[2];
    82 
    83 char *strptime (__const__ char *, __const__ char *, struct tm *);
    84 
    85 #endif
    86 
    87 
    88 #if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)) \
    89     || defined (_WITH_UNDERSCORE)
    90 
     189#endif
     190
     191/* bird: EMX/VAC/MSC legacy start. */
     192#if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)) || defined (_WITH_UNDERSCORE)
    91193extern int _daylight;
    92194extern long _timezone;
    93195extern char *_tzname[2];
    94 
    95196char *_strptime (__const__ char *, __const__ char *, struct tm *);
    96197void _tzset (void);
    97 
    98 #endif
    99 
    100 
    101 #if defined (__cplusplus)
    102 }
    103 #endif
    104 
    105 #endif /* not _TIME_H */
     198#endif
     199/* bird: EMX stuff end. */
     200
     201__END_DECLS
     202
     203#endif /* !_TIME_H_ */
     204
Note: See TracChangeset for help on using the changeset viewer.