示例#1
0
文件: LocalDateTime.cpp 项目: 119/vdc
void LocalDateTime::determineTzd(bool adjust)
{
	if (adjust)
	{
		std::time_t epochTime = _dateTime.timestamp().epochTime();
#if defined(_WIN32) || defined(POCO_NO_POSIX_TSF)
#if defined(_WIN32_WCE)
		std::tm* broken = wceex_localtime(&epochTime);
#else
		std::tm* broken = std::localtime(&epochTime);
#endif
		if (!broken) throw Poco::SystemException("cannot get local time");
		_tzd = (Timezone::utcOffset() + ((broken->tm_isdst == 1) ? 3600 : 0));
#else
		std::tm broken;
#if defined(POCO_VXWORKS)
		if (localtime_r(&epochTime, &broken) != OK)
			throw Poco::SystemException("cannot get local time");
#else
		if (!localtime_r(&epochTime, &broken))
			throw Poco::SystemException("cannot get local time");
#endif
		_tzd = (Timezone::utcOffset() + ((broken.tm_isdst == 1) ? 3600 : 0));
#endif
		adjustForTzd();
	}
	else
	{
		int dst;
		dstOffset(dst);
		_tzd = (Timezone::utcOffset() + dst);
	}
}
示例#2
0
文件: LocalDateTime.cpp 项目: 119/vdc
LocalDateTime& LocalDateTime::assign(int tzd, double julianDay)
{
	_tzd      = tzd;
	_dateTime = julianDay;
	adjustForTzd();
	return *this;
}
示例#3
0
文件: LocalDateTime.cpp 项目: 119/vdc
LocalDateTime::LocalDateTime(int tzd, const DateTime& dateTime, bool adjust):
	_dateTime(dateTime),
	_tzd(tzd)
{
	if (adjust)
		adjustForTzd();
}
示例#4
0
void LocalDateTime::determineTzd(bool adjust)
{
	std::time_t local;
	std::tm     broken;

	broken.tm_year  = (_dateTime.year() - 1900);
	broken.tm_mon   = (_dateTime.month() - 1);
	broken.tm_mday  = _dateTime.day();
	broken.tm_hour  = _dateTime.hour();
	broken.tm_min   = _dateTime.minute();
	broken.tm_sec   = _dateTime.second();
	broken.tm_isdst = -1;
	local = std::mktime(&broken);

	_tzd = (Timezone::utcOffset() + ((broken.tm_isdst == 1) ? 3600 : 0));
	if (adjust)
		adjustForTzd();
}
示例#5
0
文件: LocalDateTime.cpp 项目: 119/vdc
LocalDateTime::LocalDateTime(int tzd, const DateTime& dateTime):
	_dateTime(dateTime),
	_tzd(tzd)
{
	adjustForTzd();
}
示例#6
0
文件: LocalDateTime.cpp 项目: 119/vdc
LocalDateTime::LocalDateTime(int tzd, double julianDay):
	_dateTime(julianDay),
	_tzd(tzd)
{
	adjustForTzd();
}
示例#7
0
文件: LocalDateTime.cpp 项目: 119/vdc
LocalDateTime::LocalDateTime(Timestamp::UtcTimeVal utcTime, Timestamp::TimeDiff diff, int tzd):
	_dateTime(utcTime, diff),
	_tzd(tzd)
{
	adjustForTzd();
}