Compile-fix after modifying timercmn.cp
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5022 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -44,12 +44,35 @@ seconds since January 1, 1901, GMT.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxTime, wxObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxTime, wxObject)
|
||||||
|
|
||||||
|
|
||||||
extern bool wxGetLocalTime(long *timeZone, int *dstObserved);
|
#ifndef WX_TIMEZONE
|
||||||
extern long wxGetCurrentTime(void);
|
#define WX_TIMEZONE _timezone
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern long wxGetUTCTime(void);
|
||||||
|
bool wxGetTZandDST(long *timeZone, int *dstObserved)
|
||||||
|
{
|
||||||
|
time_t now;
|
||||||
|
struct tm *tm;
|
||||||
|
|
||||||
|
now = time((time_t *) NULL);
|
||||||
|
|
||||||
|
if (now != (time_t)-1)
|
||||||
|
{
|
||||||
|
tm = localtime(&now);
|
||||||
|
|
||||||
|
if ((tm) && (tm->tm_isdst > 0))
|
||||||
|
*dstObserved = 1;
|
||||||
|
}
|
||||||
|
*timeZone = WX_TIMEZONE;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static long TIME_ZONE; /* seconds west of GMT */
|
static long TIME_ZONE; /* seconds west of GMT */
|
||||||
static int DST_OBSERVED; /* flags U.S. daylight saving time observed */
|
static int DST_OBSERVED; /* flags U.S. daylight saving time observed */
|
||||||
@@ -57,7 +80,7 @@ static int DST_OBSERVED; /* flags U.S. daylight saving time observed */
|
|||||||
static bool wxTimeInitialized = FALSE;
|
static bool wxTimeInitialized = FALSE;
|
||||||
|
|
||||||
wxTime::tFormat wxTime::Format = wxTime::wx12h;
|
wxTime::tFormat wxTime::Format = wxTime::wx12h;
|
||||||
wxTime::tPrecision wxTime::Precision = wxTime::wxStdMinSec;
|
wxTime::tPrecision wxTime::Precision = wxTime::wxStdMinSec;
|
||||||
|
|
||||||
static const unsigned long seconds_in_day = 24*60*60L;
|
static const unsigned long seconds_in_day = 24*60*60L;
|
||||||
static const wxDate refDate(1,1,1901);
|
static const wxDate refDate(1,1,1901);
|
||||||
@@ -71,7 +94,7 @@ wxTime wxTime::GetLocalTime(const wxDate& date, hourTy h, minuteTy m, secondTy s
|
|||||||
{
|
{
|
||||||
if (!wxTimeInitialized)
|
if (!wxTimeInitialized)
|
||||||
{
|
{
|
||||||
wxGetLocalTime(&TIME_ZONE, &DST_OBSERVED);
|
wxGetTZandDST(&TIME_ZONE, &DST_OBSERVED);
|
||||||
wxTimeInitialized = TRUE;
|
wxTimeInitialized = TRUE;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@@ -96,10 +119,10 @@ wxTime::wxTime()
|
|||||||
{
|
{
|
||||||
if (!wxTimeInitialized)
|
if (!wxTimeInitialized)
|
||||||
{
|
{
|
||||||
wxGetLocalTime(&TIME_ZONE, &DST_OBSERVED);
|
wxGetTZandDST(&TIME_ZONE, &DST_OBSERVED);
|
||||||
wxTimeInitialized = TRUE;
|
wxTimeInitialized = TRUE;
|
||||||
}
|
}
|
||||||
sec = wxGetCurrentTime();
|
sec = wxGetUTCTime();
|
||||||
#ifdef __SALFORDC__
|
#ifdef __SALFORDC__
|
||||||
sec += (unsigned long) 2177452800; /* seconds from 1/1/01 to 1/1/70 */
|
sec += (unsigned long) 2177452800; /* seconds from 1/1/01 to 1/1/70 */
|
||||||
#else
|
#else
|
||||||
@@ -115,7 +138,7 @@ wxTime::wxTime(hourTy h, minuteTy m, secondTy s, bool dst)
|
|||||||
{
|
{
|
||||||
if (!wxTimeInitialized)
|
if (!wxTimeInitialized)
|
||||||
{
|
{
|
||||||
wxGetLocalTime(&TIME_ZONE, &DST_OBSERVED);
|
wxGetTZandDST(&TIME_ZONE, &DST_OBSERVED);
|
||||||
wxTimeInitialized = TRUE;
|
wxTimeInitialized = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +154,7 @@ wxTime::wxTime(const wxDate& date, hourTy h, minuteTy m, secondTy s, bool dst)
|
|||||||
{
|
{
|
||||||
if (!wxTimeInitialized)
|
if (!wxTimeInitialized)
|
||||||
{
|
{
|
||||||
wxGetLocalTime(&TIME_ZONE, &DST_OBSERVED);
|
wxGetTZandDST(&TIME_ZONE, &DST_OBSERVED);
|
||||||
wxTimeInitialized = TRUE;
|
wxTimeInitialized = TRUE;
|
||||||
}
|
}
|
||||||
sec = GetLocalTime(date,h,m,s).sec-3600;
|
sec = GetLocalTime(date,h,m,s).sec-3600;
|
||||||
|
Reference in New Issue
Block a user