trunk/branch integration: VxWorks & Wince

This commit is contained in:
Marian Krivos 2011-08-22 18:06:28 +00:00
parent 28c92f869f
commit e06af24e2e
3 changed files with 15 additions and 4 deletions

View File

@ -1,7 +1,7 @@
//
// Timezone.cpp
//
// $Id: //poco/svn/Foundation/src/Timezone.cpp#2 $
// $Id: //poco/1.4/Foundation/src/Timezone.cpp#2 $
//
// Library: Foundation
// Package: DateTime
@ -39,7 +39,13 @@
#if defined(POCO_OS_FAMILY_WINDOWS)
#if defined(_WIN32_WCE)
#include "Timezone_WINCE.cpp"
#else
#include "Timezone_WIN32.cpp"
#endif
#elif defined(POCO_VXWORKS)
#include "Timezone_VX.cpp"
#else
#include "Timezone_UNIX.cpp"
#endif

View File

@ -1,7 +1,7 @@
//
// Timezone_UNIX.cpp
//
// $Id: //poco/svn/Foundation/src/Timezone_UNIX.cpp#2 $
// $Id: //poco/1.4/Foundation/src/Timezone_UNIX.cpp#1 $
//
// Library: Foundation
// Package: DateTime
@ -35,6 +35,7 @@
#include "Poco/Timezone.h"
#include "Poco/Exception.h"
#include <ctime>
@ -84,7 +85,8 @@ int Timezone::dst()
{
std::time_t now = std::time(NULL);
struct std::tm t;
localtime_r(&now, &t);
if (!localtime_r(&now, &t))
throw Poco::SystemException("cannot get local time DST offset");
return t.tm_isdst == 1 ? 3600 : 0;
}
@ -93,6 +95,7 @@ bool Timezone::isDst(const Timestamp& timestamp)
{
std::time_t time = timestamp.epochTime();
struct std::tm* tms = std::localtime(&time);
if (!tms) throw Poco::SystemException("cannot get local time DST flag");
return tms->tm_isdst > 0;
}

View File

@ -1,7 +1,7 @@
//
// Timezone_WIN32.cpp
//
// $Id: //poco/svn/Foundation/src/Timezone_WIN32.cpp#2 $
// $Id: //poco/1.4/Foundation/src/Timezone_WIN32.cpp#1 $
//
// Library: Foundation
// Package: DateTime
@ -36,6 +36,7 @@
#include "Poco/Timezone.h"
#include "Poco/UnicodeConverter.h"
#include "Poco/Exception.h"
#include "Poco/UnWindows.h"
#include <ctime>
@ -63,6 +64,7 @@ bool Timezone::isDst(const Timestamp& timestamp)
{
std::time_t time = timestamp.epochTime();
struct std::tm* tms = std::localtime(&time);
if (!tms) throw Poco::SystemException("cannot get local time DST flag");
return tms->tm_isdst > 0;
}