2000-07-22 19:01:53 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* */
|
2013-05-09 11:56:54 +00:00
|
|
|
/* time.h */
|
2000-07-22 19:01:53 +00:00
|
|
|
/* */
|
2013-05-09 11:56:54 +00:00
|
|
|
/* Date and time */
|
2000-07-22 19:01:53 +00:00
|
|
|
/* */
|
|
|
|
/* */
|
|
|
|
/* */
|
2012-02-06 20:17:54 +00:00
|
|
|
/* (C) 1998-2012 Ullrich von Bassewitz */
|
2014-06-30 09:10:35 +00:00
|
|
|
/* Roemerstrasse 52 */
|
2003-08-16 08:23:01 +00:00
|
|
|
/* D-70794 Filderstadt */
|
|
|
|
/* EMail: uz@cc65.org */
|
2000-07-22 19:01:53 +00:00
|
|
|
/* */
|
|
|
|
/* */
|
|
|
|
/* This software is provided 'as-is', without any expressed or implied */
|
|
|
|
/* warranty. In no event will the authors be held liable for any damages */
|
|
|
|
/* arising from the use of this software. */
|
|
|
|
/* */
|
|
|
|
/* Permission is granted to anyone to use this software for any purpose, */
|
|
|
|
/* including commercial applications, and to alter it and redistribute it */
|
|
|
|
/* freely, subject to the following restrictions: */
|
|
|
|
/* */
|
|
|
|
/* 1. The origin of this software must not be misrepresented; you must not */
|
|
|
|
/* claim that you wrote the original software. If you use this software */
|
|
|
|
/* in a product, an acknowledgment in the product documentation would be */
|
|
|
|
/* appreciated but is not required. */
|
|
|
|
/* 2. Altered source versions must be plainly marked as such, and must not */
|
|
|
|
/* be misrepresented as being the original software. */
|
|
|
|
/* 3. This notice may not be removed or altered from any source */
|
|
|
|
/* distribution. */
|
|
|
|
/* */
|
|
|
|
/*****************************************************************************/
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _TIME_H
|
|
|
|
#define _TIME_H
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-07-22 19:01:53 +00:00
|
|
|
/* NULL pointer */
|
2005-04-02 16:26:55 +00:00
|
|
|
#ifndef _HAVE_NULL
|
2013-05-09 11:56:54 +00:00
|
|
|
#define NULL 0
|
2003-08-16 08:23:01 +00:00
|
|
|
#define _HAVE_NULL
|
|
|
|
#endif
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2002-11-13 13:08:46 +00:00
|
|
|
/* size_t is needed */
|
2003-08-16 08:23:01 +00:00
|
|
|
#ifndef _HAVE_size_t
|
|
|
|
#define _HAVE_size_t
|
2002-11-13 13:08:46 +00:00
|
|
|
typedef unsigned size_t;
|
|
|
|
#endif
|
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
typedef unsigned long time_t;
|
|
|
|
typedef unsigned long clock_t;
|
2018-08-15 13:59:11 +00:00
|
|
|
typedef unsigned char clockid_t;
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
/* Structure for broken down time */
|
2018-08-15 13:59:11 +00:00
|
|
|
struct tm {
|
2013-05-09 11:56:54 +00:00
|
|
|
int tm_sec;
|
2002-11-12 22:01:32 +00:00
|
|
|
int tm_min;
|
|
|
|
int tm_hour;
|
|
|
|
int tm_mday;
|
|
|
|
int tm_mon;
|
|
|
|
int tm_year;
|
|
|
|
int tm_wday;
|
|
|
|
int tm_yday;
|
|
|
|
int tm_isdst;
|
2000-05-28 13:40:48 +00:00
|
|
|
};
|
|
|
|
|
2018-08-15 13:59:11 +00:00
|
|
|
/* Structure for seconds and nanoseconds */
|
|
|
|
struct timespec {
|
|
|
|
time_t tv_sec;
|
|
|
|
long tv_nsec;
|
|
|
|
};
|
|
|
|
|
2002-11-12 22:01:32 +00:00
|
|
|
/* Timezone representation, default is UTC */
|
|
|
|
extern struct _timezone {
|
|
|
|
char daylight; /* True if daylight savings time active */
|
|
|
|
long timezone; /* Number of seconds behind UTC */
|
|
|
|
char tzname[5]; /* Name of timezone, e.g. CET */
|
|
|
|
char dstname[5]; /* Name when daylight true, e.g. CEST */
|
|
|
|
} _tz;
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-25 13:06:44 +00:00
|
|
|
#if defined(__ATARI5200__)
|
|
|
|
# define CLOCKS_PER_SEC 60
|
2003-04-14 08:08:14 +00:00
|
|
|
#elif defined(__ATMOS__)
|
2020-10-25 13:06:44 +00:00
|
|
|
# define CLOCKS_PER_SEC 100
|
2003-04-14 08:08:14 +00:00
|
|
|
#elif defined(__CBM__)
|
2001-09-14 07:53:34 +00:00
|
|
|
# if defined(__CBM510__) || defined(__CBM610__)
|
|
|
|
/* The 510/610 gets its clock from the AC current */
|
2020-10-25 13:06:44 +00:00
|
|
|
# define CLOCKS_PER_SEC 50
|
2000-05-28 13:40:48 +00:00
|
|
|
# else
|
2020-10-25 13:06:44 +00:00
|
|
|
# define CLOCKS_PER_SEC 60
|
2000-05-28 13:40:48 +00:00
|
|
|
# endif
|
2003-04-15 20:47:12 +00:00
|
|
|
#elif defined(__NES__)
|
2020-10-25 13:06:44 +00:00
|
|
|
# define CLOCKS_PER_SEC 50
|
2015-07-15 11:18:12 +00:00
|
|
|
#elif defined(__PCE__)
|
2020-10-25 13:06:44 +00:00
|
|
|
# define CLOCKS_PER_SEC 60
|
2015-11-14 12:15:29 +00:00
|
|
|
#elif defined(__GAMATE__)
|
2020-10-25 13:06:44 +00:00
|
|
|
# define CLOCKS_PER_SEC 135 /* FIXME */
|
2005-07-17 11:59:46 +00:00
|
|
|
#elif defined(__GEOS__)
|
2020-10-25 13:06:44 +00:00
|
|
|
# define CLOCKS_PER_SEC 1
|
|
|
|
#else
|
|
|
|
/* Read the clock rate at runtime */
|
|
|
|
clock_t _clocks_per_sec (void);
|
|
|
|
# define CLOCKS_PER_SEC _clocks_per_sec()
|
2000-05-28 13:40:48 +00:00
|
|
|
#endif
|
2020-10-25 13:06:44 +00:00
|
|
|
#define CLK_TCK CLOCKS_PER_SEC
|
2018-08-15 13:59:11 +00:00
|
|
|
#define CLOCK_REALTIME 0
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2002-11-12 22:35:40 +00:00
|
|
|
/* ISO C function prototypes */
|
2002-11-12 22:01:32 +00:00
|
|
|
char* __fastcall__ asctime (const struct tm* timep);
|
2000-05-28 13:40:48 +00:00
|
|
|
clock_t clock (void);
|
2002-11-12 22:01:32 +00:00
|
|
|
char* __fastcall__ ctime (const time_t* timep);
|
|
|
|
struct tm* __fastcall__ gmtime (const time_t* timep);
|
|
|
|
struct tm* __fastcall__ localtime (const time_t* timep);
|
|
|
|
time_t __fastcall__ mktime (struct tm* timep);
|
2002-11-13 13:08:46 +00:00
|
|
|
size_t __fastcall__ strftime (char* buf, size_t bufsize, const char* format, const struct tm* tm);
|
2002-11-12 19:54:30 +00:00
|
|
|
time_t __fastcall__ time (time_t* t);
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2018-08-15 13:59:11 +00:00
|
|
|
/* POSIX function prototypes */
|
|
|
|
int __fastcall__ clock_getres (clockid_t clock_id, struct timespec *res);
|
|
|
|
int __fastcall__ clock_gettime (clockid_t clock_id, struct timespec *tp);
|
|
|
|
int __fastcall__ clock_settime (clockid_t clock_id, const struct timespec *tp);
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
/* End of time.h */
|
|
|
|
|
|
|
|
#endif
|