]> git.sur5r.net Git - cc65/blob - include/time.h
Fixed _textcolor definition.
[cc65] / include / time.h
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                                  time.h                                   */
4 /*                                                                           */
5 /*                               Date and time                               */
6 /*                                                                           */
7 /*                                                                           */
8 /*                                                                           */
9 /* (C) 1998-2012 Ullrich von Bassewitz                                       */
10 /*               Roemerstrasse 52                                            */
11 /*               D-70794 Filderstadt                                         */
12 /* EMail:        uz@cc65.org                                                 */
13 /*                                                                           */
14 /*                                                                           */
15 /* This software is provided 'as-is', without any expressed or implied       */
16 /* warranty.  In no event will the authors be held liable for any damages    */
17 /* arising from the use of this software.                                    */
18 /*                                                                           */
19 /* Permission is granted to anyone to use this software for any purpose,     */
20 /* including commercial applications, and to alter it and redistribute it    */
21 /* freely, subject to the following restrictions:                            */
22 /*                                                                           */
23 /* 1. The origin of this software must not be misrepresented; you must not   */
24 /*    claim that you wrote the original software. If you use this software   */
25 /*    in a product, an acknowledgment in the product documentation would be  */
26 /*    appreciated but is not required.                                       */
27 /* 2. Altered source versions must be plainly marked as such, and must not   */
28 /*    be misrepresented as being the original software.                      */
29 /* 3. This notice may not be removed or altered from any source              */
30 /*    distribution.                                                          */
31 /*                                                                           */
32 /*****************************************************************************/
33
34
35
36 #ifndef _TIME_H
37 #define _TIME_H
38
39
40
41 /* NULL pointer */
42 #ifndef _HAVE_NULL
43 #define NULL    0
44 #define _HAVE_NULL
45 #endif
46
47 /* size_t is needed */
48 #ifndef _HAVE_size_t
49 #define _HAVE_size_t
50 typedef unsigned size_t;
51 #endif
52
53 typedef unsigned long time_t;
54 typedef unsigned long clock_t;
55 typedef unsigned char clockid_t;
56
57 /* Structure for broken down time */
58 struct tm {
59     int     tm_sec;
60     int     tm_min;
61     int     tm_hour;
62     int     tm_mday;
63     int     tm_mon;
64     int     tm_year;
65     int     tm_wday;
66     int     tm_yday;
67     int     tm_isdst;
68 };
69
70 /* Structure for seconds and nanoseconds */
71 struct timespec {
72     time_t  tv_sec;
73     long    tv_nsec;
74 };
75
76 /* Timezone representation, default is UTC */
77 extern struct _timezone {
78     char    daylight;   /* True if daylight savings time active */
79     long    timezone;   /* Number of seconds behind UTC */
80     char    tzname[5];  /* Name of timezone, e.g. CET */
81     char    dstname[5]; /* Name when daylight true, e.g. CEST */
82 } _tz;
83
84
85
86 #if defined(__ATARI__)
87 /* The clock depends on the video standard, so read it at runtime */
88 unsigned _clocks_per_sec (void);
89 #  define CLK_TCK               _clocks_per_sec()
90 #  define CLOCKS_PER_SEC        _clocks_per_sec()
91 #elif defined(__ATARI5200__)
92 #  define CLK_TCK               60      /* POSIX */
93 #  define CLOCKS_PER_SEC        60      /* ANSI */
94 #elif defined(__ATMOS__)
95 #  define CLK_TCK               100     /* POSIX */
96 #  define CLOCKS_PER_SEC        100     /* ANSI */
97 #elif defined(__CBM__)
98 #  if defined(__CBM510__) || defined(__CBM610__)
99 /* The 510/610 gets its clock from the AC current */
100 #    define CLK_TCK             50      /* POSIX */
101 #    define CLOCKS_PER_SEC      50      /* ANSI */
102 #  else
103 #    define CLK_TCK             60      /* POSIX */
104 #    define CLOCKS_PER_SEC      60      /* ANSI */
105 #  endif
106 #elif defined(__NES__)
107 #  define CLK_TCK               50      /* POSIX */
108 #  define CLOCKS_PER_SEC        50      /* ANSI */
109 #elif defined(__PCE__)
110 #  define CLK_TCK               60      /* POSIX */
111 #  define CLOCKS_PER_SEC        60      /* ANSI */
112 #elif  defined(__GAMATE__)
113 #  define CLK_TCK               135     /* POSIX */     /* FIXME */
114 #  define CLOCKS_PER_SEC        135     /* ANSI */      /* FIXME */
115 #elif  defined(__GEOS__)
116 #  define CLK_TCK               1       /* POSIX */
117 #  define CLOCKS_PER_SEC        1       /* ANSI */
118 #elif defined(__LYNX__)
119 /* The clock-rate depends on the video scan-rate;
120 ** so, read it at run-time.
121 */
122 extern clock_t _clk_tck (void);
123 #  define CLK_TCK               _clk_tck()
124 #  define CLOCKS_PER_SEC        _clk_tck()
125 #endif
126 #define CLOCK_REALTIME          0
127
128
129
130 /* ISO C function prototypes */
131 char* __fastcall__ asctime (const struct tm* timep);
132 clock_t clock (void);
133 char* __fastcall__ ctime (const time_t* timep);
134 struct tm* __fastcall__ gmtime (const time_t* timep);
135 struct tm* __fastcall__ localtime (const time_t* timep);
136 time_t __fastcall__ mktime (struct tm* timep);
137 size_t __fastcall__ strftime (char* buf, size_t bufsize, const char* format, const struct tm* tm);
138 time_t __fastcall__ time (time_t* t);
139
140
141
142 /* POSIX function prototypes */
143 int __fastcall__ clock_getres (clockid_t clock_id, struct timespec *res);
144 int __fastcall__ clock_gettime (clockid_t clock_id, struct timespec *tp);
145 int __fastcall__ clock_settime (clockid_t clock_id, const struct timespec *tp);
146
147
148
149 /* End of time.h */
150
151 #endif
152
153
154