本文整理汇总了C++中wxDateTime函数的典型用法代码示例。如果您正苦于以下问题:C++ wxDateTime函数的具体用法?C++ wxDateTime怎么用?C++ wxDateTime使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wxDateTime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mmDateRange
mmLast12Months::mmLast12Months()
: mmDateRange()
{
this->end_date_ = wxDateTime(this->start_date_).GetLastMonthDay();
this->start_date_ = wxDateTime(end_date_).SetDay(1)
.Add(wxDateSpan::Months(1))
.Subtract(wxDateSpan::Years(1));
this->title_ = wxTRANSLATE("Last 12 Months");
}
示例2: wxQtConvertDate
wxDateTime wxQtConvertDate(const QDate& date)
{
if ( !date.isNull() )
return wxDateTime(date.day(),
static_cast<wxDateTime::Month>(date.month() - 1),
date.year(), 0, 0, 0, 0);
else
return wxDateTime();
}
示例3: f
void GRIBUIDialog::OpenFile(bool newestFile)
{
m_bpPlay->SetBitmap(*m_bPlay);
m_bpPlay->SetToolTip(_("Play"));
m_tPlayStop.Stop();
m_cRecordForecast->Clear();
/* this should be un-commented to avoid a memory leak,
but for some reason it crbashes windows */
// delete m_bGRIBActiveFile;
m_pTimelineSet = NULL;
//get more recent file in default directory if necessary
wxFileName f( m_file_name );
if( newestFile || f.GetFullName().IsEmpty() ) m_file_name = GetNewestFileInDirectory();
m_bGRIBActiveFile = new GRIBFile( m_file_name,
pPlugIn->GetCopyFirstCumRec(),
pPlugIn->GetCopyMissWaveRec() );
ArrayOfGribRecordSets *rsa = m_bGRIBActiveFile->GetRecordSetArrayPtr();
if(rsa->GetCount() < 2)
m_TimeLineHours = 0;
else {
GribRecordSet &first=rsa->Item(0), &last = rsa->Item(rsa->GetCount()-1);
wxTimeSpan span = wxDateTime(last.m_Reference_Time) - wxDateTime(first.m_Reference_Time);
m_TimeLineHours = span.GetHours();
m_sTimeline->Enable();
}
m_sTimeline->SetValue(0);
wxFileName fn( m_file_name );
SetLabel( fn.GetFullName() );
if( m_bGRIBActiveFile ) {
if( m_bGRIBActiveFile->IsOK() ) {
//there could be valid but empty file
if( rsa->GetCount() == 0 ) {
m_bGRIBActiveFile = NULL;
pPlugIn->GetGRIBOverlayFactory()->SetMessage( _("Error: No valid data in this file!") );
} else
PopulateComboDataList( 0 );
} else {
if( fn.IsDir() ) {
pPlugIn->GetGRIBOverlayFactory()->SetMessage( _("Warning: Empty directory!") );
SetLabel( fn.GetFullPath() );
}
else
pPlugIn->GetGRIBOverlayFactory()->SetMessage( m_bGRIBActiveFile->GetLastMessage() );
}
SetFactoryOptions();
DisplayDataGRS();
PopulateTrackingControls();
}
}
示例4: dlg
void udfPaymentHistory::OnUpdate( wxCommandEvent& event )
{
do
{
unsigned int nItem = m_listPayments->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if(-1 == nItem)
break;
unsigned int nId = *(int*)m_listPayments->GetItemData(nItem);
CPaymentHistoryTable::tTableIt it = m_payments.find(nId);
if(it == m_payments.end())
break;
CPaymentHistoryTable::tDATA& data = it->second;
udfPayment dlg(this);
dlg.SetPayDate(data.payDate);
dlg.SetExpDate(data.expDate);
if (data.sum == -1.0)
dlg.SetFreeCheck(true);
else
dlg.SetSum(data.sum);
// fill dialog fields
if(dlg.ShowModal() == wxID_OK)
{
data.payDate = dlg.GetPayDate().GetTicks();
data.expDate = dlg.GetExpDate().GetTicks();
if(dlg.GetFreeCheck())
data.sum = -1.0;
else
data.sum = dlg.GetSum();
if(UDF_OK != CPaymentHistoryTable(m_pCon).UpdateRow(nId, data))
break;
int nCol = 1;
wxListItem info;
info.SetId(nItem);
info.SetText(wxDateTime(data.payDate).Format(STR_FORMAT_DATE));
m_listPayments->SetItem(info);
info.SetColumn(nCol++);
info.SetText(wxDateTime(data.expDate).Format(STR_FORMAT_DATE));
m_listPayments->SetItem(info);
info.SetColumn(nCol++);
if (data.sum == -1.0)
info.SetText(STR_FREE);
else
info.SetText(wxString::Format(STR_FORMAT_SUM, data.sum));
m_listPayments->SetItem(info);
}
} while(0);
}
示例5: wxBoxSizer
void PanelOptionsParameters::CreateControls()
{
////@begin PanelOptionsParameters content construction
PanelOptionsParameters* itemPanel1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
itemPanel1->SetSizer(itemBoxSizer2);
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_RIGHT|wxALL, 5);
wxStaticText* itemStaticText4 = new wxStaticText( itemPanel1, ID_LBL_Underlying, _("Underlying:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
itemBoxSizer3->Add(itemStaticText4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_txtUnderlying = new wxTextCtrl( itemPanel1, ID_TXT_Underlying, _("GLD"), wxDefaultPosition, wxDefaultSize, 0 );
m_txtUnderlying->SetMaxLength(10);
itemBoxSizer3->Add(m_txtUnderlying, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer2->Add(itemBoxSizer6, 0, wxALIGN_RIGHT|wxALL, 5);
wxStaticText* itemStaticText7 = new wxStaticText( itemPanel1, ID_LBL_OPTIONNEARDATE, _("Near Date:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
itemBoxSizer6->Add(itemStaticText7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_ctrlNearDate = new wxDatePickerCtrl( itemPanel1, ID_DATE_NearDate, wxDateTime(), wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT );
itemBoxSizer6->Add(m_ctrlNearDate, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer2->Add(itemBoxSizer9, 0, wxALIGN_RIGHT|wxALL, 5);
wxStaticText* itemStaticText10 = new wxStaticText( itemPanel1, ID_LBL_OPTIONFARDATE, _("Far Date:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
itemBoxSizer9->Add(itemStaticText10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_ctrlFarDate = new wxDatePickerCtrl( itemPanel1, ID_DATE_FarDate, wxDateTime(), wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT );
itemBoxSizer9->Add(m_ctrlFarDate, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer2->Add(itemBoxSizer12, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
m_btnStart = new wxButton( itemPanel1, ID_BTN_START, _("Start"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer12->Add(m_btnStart, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_btnStop = new wxButton( itemPanel1, ID_BTN_STOP, _("Stop"), wxDefaultPosition, wxDefaultSize, 0 );
m_btnStop->Enable(false);
itemBoxSizer12->Add(m_btnStop, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxBoxSizer* itemBoxSizer15 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer2->Add(itemBoxSizer15, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
m_btnSave = new wxButton( itemPanel1, ID_BTN_SAVE, _("Save"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer15->Add(m_btnSave, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
////@end PanelOptionsParameters content construction
}
示例6: wxDateTime
void CGarbageCollector::RecycleTaskInstances()
{
BSLERRCODE rc;
std::vector<CTaskInstance*> oTaskInstances;
std::vector<CTaskInstance*>::iterator iter;
CTaskInstance* pTaskInstance = NULL;
CRPCProfile* pRPCProfile = NULL;
CSyncProfile* pSyncProfile = NULL;
wxDateTime dtExpirationDate = wxDateTime((time_t)0);
wxDateTime dtRPCCompletedDate = wxDateTime((time_t)0);
wxUint32 uiInterval = 0;
rc = m_pHost->FindSyncProfile(CBSLClient::AutoSyncPropertyTaskInstancesUpdateInterval, &pSyncProfile);
if (BSLERR_SUCCESS != rc) return;
if (!pSyncProfile) return;
rc = m_pHost->FindRPCProfile(CLASSINFO(CRPCSyncTaskInstances)->GetClassName(), &pRPCProfile);
if (BSLERR_SUCCESS != rc) return;
if (!pRPCProfile) return;
uiInterval = pSyncProfile->GetValue();
if (!uiInterval) return;
dtRPCCompletedDate = pRPCProfile->GetLastRequestTime() + pRPCProfile->GetTotalDuration();
rc = m_pHost->EnumerateTaskInstances(oTaskInstances);
if (BSLERR_SUCCESS != rc) return;
for (iter = oTaskInstances.begin(); iter != oTaskInstances.end(); ++iter)
{
pTaskInstance = *iter;
// An item is deemed expired if it wasn't refreshed the last time the synchronize
// RPC was called.
//
dtExpirationDate =
pTaskInstance->GetLastModifiedTime() +
wxTimeSpan(0, 0, uiInterval, 0) +
wxTimeSpan(0, 0, 0, 250);
if ((m_dtNow > dtExpirationDate) && (dtRPCCompletedDate > dtExpirationDate))
{
wxLogTrace(wxT("Function Status"),
wxT("CGarbageCollector::RecycleTaskInstances - Recycle '%p', dtNow: '%s', dtExpirationDate: '%s', dtRPCCompletedDate: '%s'"),
pTaskInstance,
m_dtNow.Format(wxT("%H:%M:%S.%l")).c_str(),
dtRPCCompletedDate.Format(wxT("%H:%M:%S.%l")).c_str(),
dtExpirationDate.Format(wxT("%H:%M:%S.%l")).c_str()
);
m_pHost->DeleteTaskInstance(pTaskInstance);
}
}
}
示例7: tutorial2
int
tutorial2(bool testMode)
{
int rc = 0;
if (wxFileName::IsFileReadable(wxS("smile.jpg")) &&
wxFileName::IsFileReadable(wxS("apple.gif")))
{
// Instantiation of inherited class
PdfTuto2 pdf;
if (testMode)
{
pdf.SetCreationDate(wxDateTime(1, wxDateTime::Jan, 2017));
pdf.SetCompression(false);
}
pdf.AliasNbPages();
pdf.AddPage();
pdf.Image(wxS("smile.jpg"), 70, 40, 12);
pdf.Image(wxS("apple.gif"), 110, 40, 25);
pdf.SetFont(wxS("Times"), wxS(""), 12);
int i;
for (i = 1; i <= 40; i++)
{
pdf.Cell(0, 10, wxString::Format(wxS("Printing line number %d"), i), 0, 1);
}
pdf.SaveAsFile(wxS("tutorial2.pdf"));
}
else
{
rc = 1;
}
return rc;
}
示例8: wxMemoryInputStream
wxFSFile* wxFileSystemBlobHandler::OpenFile(wxFileSystem& fs, const wxString& location)
{
auto pos = location.Find(':');
if (pos != 4) {
return 0;
}
wxString data = location.Mid(pos + 1);
if (data.size() % 2) {
return 0;
}
wxChar const* str = data.c_str();
unsigned char* buf = static_cast<unsigned char*>(malloc(data.size() / 2));
for (size_t i = 0; i < data.size() / 2; ++i) {
buf[i] = static_cast<unsigned char>(fz::hex_char_to_int(str[i * 2]) * 16 + fz::hex_char_to_int(str[i * 2 + 1]));
}
// Whoever came up with the API for the wx streams obviously didn't ever use it.
// Why else wouldn't it have an ownership-taking constructor?
auto stream = new wxMemoryInputStream(0, data.size() / 2);
// Or why does it expect a buffer allocated with malloc?
stream->GetInputStreamBuffer()->SetBufferIO(buf, data.size() / 2, true);
return new wxFSFile(stream, location, _T(""), _T(""), wxDateTime());
}
示例9: GetClubNameById
void udfTrainersMngrDlg::OnSelectTrainer(wxCommandEvent& event)
{
do
{
int nItem = m_listTrainers->GetSelection();
if(nItem == -1)
break;
int nId = *(int*)m_listTrainers->GetClientData(nItem);
CTrainersTable::tTableIt it = m_Trainers.find(nId);
if(it == m_Trainers.end())
break;
CTrainersTable::tDATA& data = it->second;
m_textName->SetValue(data.name);
m_textEmail->SetValue(data.email);
m_textInfo->SetValue(data.additionalInfo);
m_textPhone->SetValue(data.phone);
wxString clubName = GetClubNameById(data.clubId);
if(!clubName.IsEmpty())
{
m_comboClub->SetValue(clubName);
}
m_dateBd->SetValue(wxDateTime(data.bd));
}while(0);
}
示例10: WXUNUSED
wxFSFile* wxLocalFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& location)
{
// location has Unix path separators
wxString right = GetRightLocation(location);
wxFileName fn = wxFileSystem::URLToFileName(right);
wxString fullpath = ms_root + fn.GetFullPath();
if (!wxFileExists(fullpath))
return (wxFSFile*) NULL;
// we need to check whether we can really read from this file, otherwise
// wxFSFile is not going to work
wxFFileInputStream *is = new wxFFileInputStream(fullpath);
if ( !is->Ok() )
{
delete is;
return (wxFSFile*) NULL;
}
return new wxFSFile(is,
right,
GetMimeTypeFromExt(location),
GetAnchor(location)
#if wxUSE_DATETIME
,wxDateTime(wxFileModificationTime(fullpath))
#endif // wxUSE_DATETIME
);
}
示例11: wxDateTime
wxDateTime wxCalendarCtrl::GetDate() const
{
if ( !m_qtCalendar )
return wxDateTime();
return wxQtConvertDate(m_qtCalendar->selectedDate());
}
示例12: dt
void ValuesTable::InsertValue(DatabaseQuery::ValueData::V *v, bool &view_values_changed, bool& stats_updated) {
DTime dt(m_draw->GetPeriod(), wxDateTime(v->time));
int view_index = m_draw->m_index.GetStartTime().GetDistance(dt);
int index = view_index + m_view.Start();
if (index < 0 || index >= (int)m_values.size())
return;
if (m_values.at(index).IsData())
return;
ValueInfo& vi = m_values.at(index);
vi.av_val = v->response;
vi.sum = v->sum;
vi.first_val = v->first_val;
vi.last_val = v->last_val;
vi.count_probes = v->count;
switch (m_draw->m_draw_info->GetAverageValueCalculationMethod()) {
case AVERAGE_VALUE_CALCULATION_AVERAGE:
vi.db_val = v->response;
break;
case AVERAGE_VALUE_CALCULATION_LAST:
vi.db_val = v->last_val;
break;
case AVERAGE_VALUE_CALCULATION_LAST_FIRST:
vi.db_val = v->last_val - v->first_val;
break;
}
UpdateProbesValues(index, stats_updated, view_values_changed);
}
示例13: WXUNUSED
wxFSFile* wxLocalFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& location)
{
// location has Unix path separators
wxString right = GetRightLocation(location);
wxFileName fn = wxFileSystem::URLToFileName(right);
wxString fullpath = ms_root + fn.GetFullPath();
if (!wxFileExists(fullpath))
return NULL;
// we need to check whether we can really read from this file, otherwise
// wxFSFile is not going to work
#if wxUSE_FFILE
wxFFileInputStream *is = new wxFFileInputStream(fullpath);
#elif wxUSE_FILE
wxFileInputStream *is = new wxFileInputStream(fullpath);
#else
#error One of wxUSE_FILE or wxUSE_FFILE must be set to 1 for wxFSHandler to work
#endif
if ( !is->IsOk() )
{
delete is;
return NULL;
}
return new wxFSFile(is,
location,
wxEmptyString,
GetAnchor(location)
#if wxUSE_DATETIME
,wxDateTime(wxFileModificationTime(fullpath))
#endif // wxUSE_DATETIME
);
}
示例14: mmBDDialog
void Test_BillsDeposits::test_enter_simple_entry()
{
Model_Billsdeposits::Data_Set bill_table = Model_Billsdeposits::instance().all();
if (bill_table.size() < 1) return;
m_user_request->Show_InfoBarMessage(
"Please confirm Simple entry - Enter\n\n"
"Account Name: Savings, Repeats: Monthly\n"
"Amount: 200, Payee: Supermarket\n"
"Category: Food/Groceries\n");
Model_Billsdeposits::Data bill_entry = bill_table.at(bill_table.size() - 1);
mmBDDialog* dlg = new mmBDDialog(m_base_frame, bill_entry.BDID, false, true);
if (dlg->ShowModal() == wxID_OK)
{
bill_table = Model_Billsdeposits::instance().all();
bill_entry = bill_table.at(bill_table.size() - 1);
CPPUNIT_ASSERT(bill_entry.REPEATS == Model_Billsdeposits::REPEAT_MONTHLY);
wxDateTime next_date = wxDateTime(wxDateTime::Today()).Add(wxDateSpan::Month());
CPPUNIT_ASSERT(bill_entry.NEXTOCCURRENCEDATE == next_date.FormatISODate());
Model_Checking::Data_Set checking_table = Model_Checking::instance().all();
CPPUNIT_ASSERT(checking_table.size() > 0);
Model_Checking::Data checking_entry = checking_table.at(checking_table.size() - 1);
CPPUNIT_ASSERT(checking_entry.ACCOUNTID == Model_Account::instance().get("Savings")->ACCOUNTID);
CPPUNIT_ASSERT(checking_entry.TRANSAMOUNT == 200);
CPPUNIT_ASSERT(checking_entry.TOTRANSAMOUNT == 200);
}
}
示例15: wxDateTime
/// For testing: triggered by Advanced / Options menu item.
void CMainDocument::TestAsyncRPC() {
ALL_PROJECTS_LIST pl;
ASYNC_RPC_REQUEST request;
wxDateTime completionTime = wxDateTime((time_t)0);
int req_retval = 0, rpc_result = 0;
completionTime.ResetTime();
request.which_rpc = RPC_GET_ALL_PROJECTS_LIST;
request.arg1 = &pl;
request.exchangeBuf = NULL;
request.arg2 = NULL;
request.arg3 = NULL;
request.arg4 = NULL;
request.rpcType = RPC_TYPE_WAIT_FOR_COMPLETION;
request.completionTime = &completionTime;
// request.result = NULL;
request.resultPtr = &rpc_result; // For testing async RPCs
request.isActive = false;
//retval = rpcClient.get_all_projects_list(pl);
req_retval = RequestRPC(request, true);
wxString s = completionTime.FormatTime();
wxLogMessage(wxT("Completion time = %s"), s.c_str());
wxLogMessage(wxT("RequestRPC returned %d\n"), req_retval);
::wxSafeYield(NULL, true); // Allow processing of RPC_FINISHED event
wxLogMessage(wxT("rpcClient.get_all_projects_list returned %d\n"), rpc_result);
}