1 /*****************************************************************************/
9 /* (C) 1998-2012 Ullrich von Bassewitz */
10 /* Römerstrasse 52 */
11 /* D-70794 Filderstadt */
12 /* EMail: uz@cc65.org */
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. */
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: */
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 */
32 /*****************************************************************************/
47 /* size_t is needed */
50 typedef unsigned size_t;
53 typedef unsigned long time_t;
54 typedef unsigned long clock_t;
56 /* Structure for broken down time */
69 /* Timezone representation, default is UTC */
70 extern struct _timezone {
71 char daylight; /* True if daylight savings time active */
72 long timezone; /* Number of seconds behind UTC */
73 char tzname[5]; /* Name of timezone, e.g. CET */
74 char dstname[5]; /* Name when daylight true, e.g. CEST */
79 #if defined(__ATARI__)
80 /* The clock depends on the video standard, so read it at runtime */
81 unsigned _clocks_per_sec (void);
82 # define CLK_TCK _clocks_per_sec()
83 # define CLOCKS_PER_SEC _clocks_per_sec()
84 #elif defined(__ATARI5200__)
85 # define CLK_TCK 60 /* POSIX */
86 # define CLOCKS_PER_SEC 60 /* ANSI */
87 #elif defined(__ATMOS__)
88 # define CLK_TCK 100 /* POSIX */
89 # define CLOCKS_PER_SEC 100 /* ANSI */
90 #elif defined(__CBM__)
91 # if defined(__CBM510__) || defined(__CBM610__)
92 /* The 510/610 gets its clock from the AC current */
93 # define CLK_TCK 50 /* POSIX */
94 # define CLOCKS_PER_SEC 50 /* ANSI */
96 # define CLK_TCK 60 /* POSIX */
97 # define CLOCKS_PER_SEC 60 /* ANSI */
99 #elif defined(__NES__)
100 # define CLK_TCK 50 /* POSIX */
101 # define CLOCKS_PER_SEC 50 /* ANSI */
102 #elif defined(__GEOS__)
103 # define CLK_TCK 1 /* POSIX */
104 # define CLOCKS_PER_SEC 1 /* ANSI */
105 #elif defined(__LYNX__)
106 /* The clock-rate depends on the video scan-rate;
107 ** so, read it at run-time. */
108 extern clock_t _clk_tck (void);
109 # define CLK_TCK _clk_tck()
110 # define CLOCKS_PER_SEC _clk_tck()
115 time_t _systime (void);
116 /* Similar to time(), but:
118 * - Does not take the additional pointer
119 * - Does not set errno when returning -1
122 /* ISO C function prototypes */
123 char* __fastcall__ asctime (const struct tm* timep);
124 clock_t clock (void);
125 char* __fastcall__ ctime (const time_t* timep);
126 struct tm* __fastcall__ gmtime (const time_t* timep);
127 struct tm* __fastcall__ localtime (const time_t* timep);
128 time_t __fastcall__ mktime (struct tm* timep);
129 size_t __fastcall__ strftime (char* buf, size_t bufsize, const char* format, const struct tm* tm);
130 time_t __fastcall__ time (time_t* t);