amiga-ntimed/include/clib/timezone_protos.h

99 lines
3.6 KiB
C

//--------------------------------------------------------------------------//
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#ifndef _CLIB_TIMEZONE_H
#define _CLIB_TIMEZONE_H
#include <time.h>
#include <sys/time.h>
#include <sys/types.h>
#include <devices/timer.h>
#include <libraries/locale.h>
#define TZVARIABLE "timezone.prefs"
#define TZDIR "ZONEINFO:"
#define TZDEFAULT "localtime"
#define TZDEFRULES "posixrules"
#ifndef HAVE_TIMEZONE_T
typedef struct timezone* timezone_t;
#endif
#ifndef HAVE_LOCATE_T
typedef struct Locale* locale_t;
#endif
#ifndef _TIME_H_
struct tm {
int tm_sec; /* seconds after the minute [0-61] */
int tm_min; /* minutes after the hour [0-59] */
int tm_hour; /* hours since midnight [0-23] */
int tm_mday; /* day of the month [1-31] */
int tm_mon; /* months since January [0-11] */
int tm_year; /* years since 1900 */
int tm_wday; /* days since Sunday [0-6] */
int tm_yday; /* days since January 1 [0-365] */
int tm_isdst; /* Daylight Savings Time flag */
long tm_gmtoff; /* offset from UTC in seconds */
char *tm_zone; /* timezone abbreviation */
};
#endif
void tzset(void);
timezone_t tzalloc(char const *name);
void tzfree(timezone_t tz);
time_t time(time_t *p);
time_t mktime(struct tm *tmp);
time_t mktime_z(const timezone_t tz, struct tm *tmp);
struct tm* localtime(const time_t *const timep);
struct tm* localtime_r(const time_t *const timep, struct tm *tmp);
struct tm* localtime_rz(const timezone_t tz,
const time_t *const timep, struct tm *tmp);
struct tm* gmtime(const time_t *timep);
struct tm* gmtime_r(const time_t *timep, struct tm *tmp);
char* ctime(const time_t *const timep);
char* ctime_r(const time_t *const timep, char *buf);
char *ctime_rz(const timezone_t tz, const time_t *timep, char *buf);
double difftime(const time_t time1, const time_t time0);
struct tm *offtime(const time_t *timep, long offset);
struct tm *offtime_r(const time_t *timep, long offset, struct tm *tmp);
time_t timeoff(struct tm *tmp, long offset);
char* asctime(const struct tm *timeptr);
char* asctime_r(const struct tm *timeptr, char *buf);
size_t strftime(char *const s, size_t maxsize,
const char *const format, const struct tm *const t);
size_t strftime_l(char *const s, size_t maxsize,
const char *const format, const struct tm *const t,
locale_t locale);
char* strptime(const char *const buf, const char *const format,
struct tm *const t);
char* strptime_l(const char *const buf, const char *const format,
struct tm *const t,
locale_t locale);
time_t timegm(struct tm *tmp);
time_t timelocal(struct tm *tmp);
time_t timelocal_z(const timezone_t tz, struct tm *tmp);
int daylight_c();
long timezone_c();
long altzone_c();
char** tzname_c();
const char *tzgetname(const timezone_t tz, int isdst);
void tzsetwall(void);
time_t time2posix(time_t t);
time_t time2posix_z(const timezone_t tz, time_t t);
time_t posix2time(time_t t);
time_t posix2time_z(const timezone_t tz, time_t t);
int getsystime(struct timeval *tv);
int setsystime(struct timeval *tv);
#if !defined(AVOID_TIMEOFDAY) && !defined(_SYS_TIME_H_)
int gettimeofday(struct timeval *tv, const timezone_t tz);
int settimeofday(const struct timeval *tv, const timezone_t tz);
#endif
int gmtoffset(time_t tloc);
const char* tzgetlocation(void);
void stou(char *s);
void utos(char *s);
#endif