1
0
mirror of https://frontier.innolan.net/rainlance/amiga-tz.git synced 2025-11-21 17:13:37 +00:00
Files
amiga-tz/include/tz.h
2015-04-20 00:10:24 +02:00

101 lines
3.8 KiB
C

/* $NetBSD: time.h,v 1.40 2010/12/16 18:36:47 christos Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)time.h 8.3 (Berkeley) 1/21/94
*/
/**
* @file tz.h
* @brief
* Parts of this file was retrieved from:
* ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-release-6/src/include/time.h
*/
extern char *tzname[2];
struct tz_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 */
};
typedef long tz_time_t;
typedef struct state *timezone_t;
void tz_tzset(void);
void tz_free(const timezone_t);
timezone_t tz_alloc(const char *);
tz_time_t tz_time(tz_time_t *);
tz_time_t tz_mktime_z(const timezone_t, struct tz_tm *);
tz_time_t tz_mktime(struct tz_tm *);
struct tz_tm *tz_localtime_rz(const timezone_t, const tz_time_t *, struct tz_tm *);
struct tz_tm *tz_localtime_r(const tz_time_t *, struct tz_tm *);
struct tz_tm *tz_localtime(const tz_time_t *);
struct tz_tm *tz_gmtime_r(const tz_time_t *, struct tz_tm *);
struct tz_tm *tz_gmtime(const tz_time_t *);
char *tz_ctime_r(const tz_time_t *, char *);
char *tz_ctime(const tz_time_t *);
//char *asctime_r(const struct tz_tm *, char *);
double tz_difftime(tz_time_t, tz_time_t);
#ifndef HAVE_ASCTIME
//char *asctime(const struct tz_tm *);
#endif
tz_time_t time(tz_time_t *x);
#ifdef HAVENOSYSTIME
#include <clib/timer_protos.h>
tz_time_t time(tz_time_t *x)
{
struct timeval tv;
GetSysTime(&tv);
if (x) {
*x = (time_t)tv.tv_secs;
}
return (time_t)tv.tv_secs;
}
#endif