本文整理汇总了C++中wxDateTime类的典型用法代码示例。如果您正苦于以下问题:C++ wxDateTime类的具体用法?C++ wxDateTime怎么用?C++ wxDateTime使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wxDateTime类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetRange
void wxDatePickerCtrl::SetRange(const wxDateTime& dt1, const wxDateTime& dt2)
{
SYSTEMTIME st[2];
DWORD flags = 0;
if ( dt1.IsValid() )
{
dt1.GetAsMSWSysTime(st + 0);
flags |= GDTR_MIN;
}
if ( dt2.IsValid() )
{
dt2.GetAsMSWSysTime(st + 1);
flags |= GDTR_MAX;
}
if ( !DateTime_SetRange(GetHwnd(), flags, st) )
{
wxLogDebug(wxT("DateTime_SetRange() failed"));
return;
}
// Setting the range could have changed the current control value if the
// old one wasn't inside the new range, so update it.
m_date = MSWGetControlValue();
}
示例2: DateToStr
wxString DateToStr(const wxDateTime &datetime)
{
if (!datetime.IsValid())
return wxEmptyString;
return datetime.FormatDate() + wxT(" ") + datetime.FormatTime();
}
示例3: addDate
INLINE
void wxeReturn::addDate(wxDateTime dateTime) {
addInt(dateTime.GetYear());
addInt(dateTime.GetMonth()+1); // c++ month is zero based
addInt(dateTime.GetDay());
addTupleCount(3);
}
示例4: Run
bool CUpdater::Run()
{
if( state_ != UpdaterState::idle && state_ != UpdaterState::failed &&
state_ != UpdaterState::newversion && state_ != UpdaterState::newversion_ready )
{
return false;
}
wxDateTime const t = wxDateTime::Now();
COptions::Get()->SetOption(OPTION_UPDATECHECK_LASTDATE, t.Format(_T("%Y-%m-%d %H:%M:%S")));
local_file_.clear();
log_ = wxString::Format(_("Started update check on %s\n"), t.Format());
wxString build = CBuildInfo::GetBuildType();
if( build.empty() ) {
build = _("custom");
}
log_ += wxString::Format(_("Own build type: %s\n"), build);
SetState(UpdaterState::checking);
m_use_internal_rootcert = true;
int res = Download(GetUrl(), wxString());
if (res != FZ_REPLY_WOULDBLOCK) {
SetState(UpdaterState::failed);
}
raw_version_information_.clear();
return state_ == UpdaterState::checking;
}
示例5: saveData
void HumanoidDataLogger::saveData()
{
const wxDateTime now = wxDateTime::UNow();
wxString dataDirectory(dataSaveDirectory.c_str(),wxConvUTF8);
wxString curFilePath = dataDirectory + wxT("/recentData.dat");
dataDirectory += now.FormatISODate();
wxString dataFile = now.FormatISODate() + wxT("_") + now.FormatISOTime() + wxT(".dat");
dataFile.Replace(wxT(":"), wxT("-"));
wxString dataPath = dataDirectory + wxT("/") + dataFile;
if(! wxDirExists(dataDirectory))
{
wxMkdir(dataDirectory);
}
stringstream ss;
ss << dataPath.mb_str();
setFile(ss.str());
writeRecords();
FILE * curFile = fopen(curFilePath.mb_str(),"w");
fprintf(curFile, "%s",ss.str().c_str());
fclose(curFile);
}
示例6: eDocumentPath_shouldUpdateCygwin
//
// Returns true if this Cygwin installation should be updated (or installed for the first time.)
// Returns false if we are up-to-date.
//
bool eDocumentPath_shouldUpdateCygwin(wxDateTime &stampTime, const wxFileName &supportFile){
// E's support folder comes with a network installer for Cygwin.
// Newer versions of E may come with newer Cygwin versions.
// If the user already has Cygwin installed, we still check the
// bundled installer to see if it is newer; if so, then we need to
// re-install Cygwin at the newer version.
if (!stampTime.IsValid())
return true; // First time, so we need to update.
wxDateTime updateTime = supportFile.GetModificationTime();
// Windows doesn't store milliseconds; we clear out this part of the time.
updateTime.SetMillisecond(0);
updateTime.SetSecond(0);
stampTime.SetMillisecond(0);
stampTime.SetSecond(0);
// If the times are the same, no update needed.
if (updateTime == stampTime)
return false;
// ...else the dates differ and we need to update.
wxLogDebug(wxT("InitCygwin: Diff dates"));
wxLogDebug(wxT(" e-postinstall: %s"), updateTime.FormatTime());
wxLogDebug(wxT(" last-e-update: %s"), stampTime.FormatTime());
return true;
}
示例7: SetUtcTime
void DashboardInstrument_Moon::SetUtcTime( wxDateTime data )
{
if (data.IsValid())
{
m_phase = moon_phase(data.GetYear(), data.GetMonth() + 1, data.GetDay());
}
}
示例8: wxQtConvertDate
QDate wxQtConvertDate(const wxDateTime& date)
{
if ( date.IsValid() )
return QDate(date.GetYear(), date.GetMonth() + 1, date.GetDay());
else
return QDate();
}
示例9: SetCreateTime
void TrackPoint::SetCreateTime( wxDateTime dt )
{
wxString ts;
if(dt.IsValid())
ts = dt.FormatISODate().Append(_T("T")).Append(dt.FormatISOTime()).Append(_T("Z"));
SetCreateTime(ts);
}
示例10: pgsRandomizer
pgsDateTimeGen::pgsDateTimeGen(wxDateTime min, wxDateTime max,
const bool & sequence, const long & seed) :
pgsObjectGen(seed), m_min(min.IsEarlierThan(max) || min.IsEqualTo(max) ? min : max),
m_max(max.IsLaterThan(min) || max.IsEqualTo(min) ? max : min),
m_range(m_max.Subtract(m_min).GetSeconds()), m_sequence(sequence)
{
m_randomizer = pgsRandomizer(pnew pgsIntegerGen(0, std::string(m_range
.ToString().mb_str()).c_str(), is_sequence(), m_seed));
}
示例11: FormatDateLong
wxString FormatDateLong( const wxDateTime &aDate )
{
/* GetInfo was introduced only on wx 2.9; for portability reason an
* hardcoded format is used on wx 2.8 */
#if wxCHECK_VERSION( 2, 9, 0 )
return aDate.Format( wxLocale::GetInfo( wxLOCALE_LONG_DATE_FMT ) );
#else
return aDate.Format( wxT("%d %b %Y") );
#endif
}
示例12: MakeDateTimeLabel
wxString otcurrentUIDialog::MakeDateTimeLabel(wxDateTime myDateTime)
{
const wxString dateLabel(myDateTime.Format( _T( "%a") ));
m_staticTextDatetime->SetLabel(dateLabel);
m_datePickerDate->SetValue(myDateTime.GetDateOnly());
m_timePickerTime->SetTime(myDateTime.GetHour(),myDateTime.GetMinute(), myDateTime.GetSecond());
return dateLabel;
}
示例13: SetDateToEndOfYear
void mmReportBudget::SetDateToEndOfYear(const int day, const int month, wxDateTime& date, bool isEndDate) const
{
date.SetDay(day);
date.SetMonth((wxDateTime::Month)month);
if (isEndDate)
{
date.Subtract(wxDateSpan::Day());
date.Add(wxDateSpan::Year());
}
}
示例14: RoundDateToSpan
wxDateTime RoundDateToSpan(wxDateTime date, wxDateSpan span)
{
wxDateTime::wxDateTime_t day = date.GetDay();
int month = MonthNum(date.GetMonth());
wxDateTime::wxDateTime_t year = date.GetYear();
wxDateTime::wxDateTime_t modDays = Mod(day - 1, span.GetTotalDays());
wxDateTime::wxDateTime_t modMonths = Mod(month - 1, span.GetMonths());
wxDateTime::wxDateTime_t modYears = Mod(year, span.GetYears());
return wxDateTime(day - modDays, MonthFromNum(month - modMonths), year - modYears);
}
示例15: pgsObjectGen
pgsTimeGen::pgsTimeGen(wxDateTime min, wxDateTime max, const bool & sequence,
const long & seed) :
pgsObjectGen(seed), m_min(min.IsEarlierThan(max) || min.IsEqualTo(max) ? min : max),
m_max(max.IsLaterThan(min) || max.IsEqualTo(min) ? max : min),
m_range(m_max.Subtract(m_min).GetSeconds()), m_sequence(sequence)
{
m_min.SetYear(1970); // We know this date is not a DST date
m_min.SetMonth(wxDateTime::Jan);
m_min.SetDay(1);
m_randomizer = pgsRandomizer(pnew pgsIntegerGen(0, std::string(m_range
.ToString().mb_str()).c_str(), is_sequence(), m_seed));
}