X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c801d85f158c4cba50b588807daabdcbd0ed3853..0d2a2b601b1994333886dff8f53d82a714c4042f:/src/common/time.cpp diff --git a/src/common/time.cpp b/src/common/time.cpp index 852de83041..3b9ce52b58 100644 --- a/src/common/time.cpp +++ b/src/common/time.cpp @@ -27,19 +27,24 @@ seconds since January 1, 1901, GMT. #include "wx/setup.h" -#if USE_TIMEDATE +#ifdef wxUSE_TIMEDATE #include "wx/time.h" #include "wx/date.h" #include "wx/utils.h" +#include -#if USE_IOSTREAMH +#if wxUSE_IOSTREAMH #include +#include #else #include +#include +# ifdef _MSC_VER + using namespace std; +# endif #endif -#include #include #if !USE_SHARED_LIBRARY @@ -99,7 +104,11 @@ wxTime::wxTime() wxTimeInitialized = TRUE; } sec = wxGetCurrentTime(); - sec += 2177452800L; /* seconds from 1/1/01 to 1/1/70 */ +#ifdef __SALFORDC__ + sec += (unsigned long) 2177452800; /* seconds from 1/1/01 to 1/1/70 */ +#else + sec += 2177452800UL; /* seconds from 1/1/01 to 1/1/70 */ +#endif } wxTime::wxTime(hourTy h, minuteTy m, secondTy s, bool dst) @@ -141,12 +150,13 @@ wxTime::wxTime(const wxDate& date, hourTy h, minuteTy m, secondTy s, bool dst) /* if (IsDST()) setError(NIHCL_BADTIME,DEFAULT, date.dayOfMonth(),date.nameOfMonth(),date.year(), - h,m,s,(dst?"DST":"")); + h,m,s,(dst?_("DST"):"")); */ } sec += TIME_ZONE; // adjust to GMT } +#ifndef __SALFORDC__ wxTime::operator wxDate() const /* Convert a wxTime to a local wxDate @@ -159,6 +169,7 @@ wxTime::operator wxDate() const date += daycount; return date; } +#endif bool wxTime::IsBetween(const wxTime& a, const wxTime& b) const { @@ -266,6 +277,38 @@ secondTy wxTime::GetSecond() const return (secondTy)(((sec % 86400) % 3600) % 60); } +secondTy wxTime::GetSecondGMT() const +/* + Return the minute of this wxTime in GMT. +*/ +{ + return (secondTy)(((sec % 86400) % 3600) % 60); +} + +int wxTime::GetDay() const +{ + wxDate da((wxDate) *this); + return da.GetDay(); +} + +int wxTime::GetDayOfWeek() const +{ + wxDate da((wxDate) *this); + return da.GetDayOfWeek(); +} + +int wxTime::GetMonth() const +{ + wxDate da((wxDate) *this); + return da.GetMonth(); +} + +int wxTime::GetYear() const +{ + wxDate da((wxDate) *this); + return da.GetYear(); +} + wxTime wxTime::Max(const wxTime& t) const { if (t < *this) return *this; @@ -278,10 +321,12 @@ wxTime wxTime::Min(const wxTime& t) const return t; } +#ifndef __SALFORDC__ wxTime::operator char *(void) { return FormatTime(); } +#endif void wxTime::SetFormat(const wxTime::tFormat lFormat, const wxTime::tPrecision lPrecision) { @@ -313,9 +358,9 @@ char *wxTime::FormatTime() const { if (Format == wx12h) if (GetHour() <= 12) - strcat(timeBuf,"am"); + strcat(timeBuf,_("am")); else - strcat(timeBuf,"pm"); + strcat(timeBuf,_("pm")); return timeBuf; } @@ -348,8 +393,8 @@ void wxTime::printOn(ostream& strm) const strm << ' ' << ((hh <= 12) ? hh : hh-12) << ':' << setfill('0') << setw(2) << GetMinute() << ':' << setfill('0') << setw(2) << GetSecond() << ' '; - if (hh < 12) strm << "am"; - else strm << "pm"; + if (hh < 12) strm << _("am"); + else strm << _("pm"); } wxTime::wxTime(OIOin& strm)