/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Research
*
* Time_t conversion support
*/
#include <tmx.h>
/*
* convert Tm_t to Time_t
*
* if west==TM_LOCALZONE then the local timezone is used
* otherwise west is the number of minutes west
* of GMT with DST taken into account
*
* this routine works with a copy of Tm_t to avoid clashes
* with other tm*() that may return static Tm_t*
*/
{
register Time_t t;
register int32_t y;
int n;
int sec;
return TMX_NOTIME;
y--;
t = y * 365 + y / 4 - y / 100 + (y + (1900 - 1600)) / 400 - (1970 - 1901) * 365 - (1970 - 1901) / 4;
n = 11;
y += 1901;
if (n > 1 && tmisleapyear(y))
t++;
t *= 24;
t *= 60;
t *= 60;
{
/*
* time zone adjustments
*/
if (west == TM_LOCALZONE)
{
else
{
return TMX_NOTIME;
}
}
else
{
t += west * 60;
{
return TMX_NOTIME;
}
}
}
{
/*
* leap second adjustments
*/
t -= n;
}
}