Example #1
0
void
localtime_r(const time_t * timer, struct tm * timeptr)
{
	time_t          lt;
	int16_t         dst;

	dst = -1;

	if (__dst_ptr)
		dst = __dst_ptr(timer, &__utc_offset);

	lt = *timer + __utc_offset;

	if (dst > 0)
		lt += dst;

	gmtime_r(&lt, timeptr);
	timeptr->tm_isdst = dst;
}
Example #2
0
time_t
mktime(struct tm * timeptr)
{
	time_t          ret;

	ret = mk_gmtime(timeptr);

	if (timeptr->tm_isdst < 0) {
		if (__dst_ptr)
			timeptr->tm_isdst = __dst_ptr(&ret, &__utc_offset);
	}
	if (timeptr->tm_isdst > 0)
		ret -= timeptr->tm_isdst;

	ret -= __utc_offset;

	localtime_r(&ret, timeptr);

	return ret;
}