]> git.sur5r.net Git - cc65/blob - include/time.h
Add CLK_TCK for atmos
[cc65] / include / time.h
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                                  time.h                                   */
4 /*                                                                           */
5 /*                               Date and time                               */
6 /*                                                                           */
7 /*                                                                           */
8 /*                                                                           */
9 /* (C) 1998-2002 Ullrich von Bassewitz                                       */
10 /*               Wacholderweg 14                                             */
11 /*               D-70597 Stuttgart                                           */
12 /* EMail:        uz@musoftware.de                                            */
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 #ifdef NULL
43 #  undef NULL
44 #endif
45 #define NULL    0
46
47 /* size_t is needed */
48 #ifndef _SIZE_T
49 #define _SIZE_T
50 typedef unsigned size_t;
51 #endif
52
53 typedef unsigned long time_t;
54 typedef unsigned long clock_t;
55
56 /* Structure for broken down time */
57 struct tm {
58     int     tm_sec;
59     int     tm_min;
60     int     tm_hour;
61     int     tm_mday;
62     int     tm_mon;
63     int     tm_year;
64     int     tm_wday;
65     int     tm_yday;
66     int     tm_isdst;
67 };
68
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 */
75 } _tz;
76
77
78
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(__ATMOS__)
85 #  define CLK_TCK               100     /* POSIX */
86 #  define CLOCKS_PER_SEC        100     /* ANSI */
87 #elif defined(__CBM__)
88 #  if defined(__CBM510__) || defined(__CBM610__)
89 /* The 510/610 gets its clock from the AC current */
90 #    define CLK_TCK             50      /* POSIX */
91 #    define CLOCKS_PER_SEC      50      /* ANSI */
92 #  else
93 #    define CLK_TCK             60      /* POSIX */
94 #    define CLOCKS_PER_SEC      60      /* ANSI */
95 #  endif
96 #endif
97
98
99
100 time_t _systime (void);
101 /* Similar to time(), but:
102  *   - Is not ISO C
103  *   - Does not take the additional pointer
104  *   - Does not set errno when returning -1
105  */
106
107 /* ISO C function prototypes */
108 char* __fastcall__ asctime (const struct tm* timep);
109 clock_t clock (void);
110 char* __fastcall__ ctime (const time_t* timep);
111 struct tm* __fastcall__ gmtime (const time_t* timep);
112 struct tm* __fastcall__ localtime (const time_t* timep);
113 time_t __fastcall__ mktime (struct tm* timep);
114 size_t __fastcall__ strftime (char* buf, size_t bufsize, const char* format, const struct tm* tm);
115 time_t __fastcall__ time (time_t* t);
116
117
118
119 /* End of time.h */
120
121 #endif
122
123
124