本文整理汇总了C++中wxDateTime类的典型用法代码示例。如果您正苦于以下问题:C++ wxDateTime类的具体用法?C++ wxDateTime怎么用?C++ wxDateTime使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wxDateTime类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:nE0sIghT,项目名称:wxWidgets,代码行数:27,代码来源:datectrl.cpp
示例2: DateToStr
wxString DateToStr(const wxDateTime &datetime)
{
if (!datetime.IsValid())
return wxEmptyString;
return datetime.FormatDate() + wxT(" ") + datetime.FormatTime();
}
开发者ID:swflb,项目名称:pgadmin3,代码行数:7,代码来源:misc.cpp
示例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);
}
开发者ID:AlainODea,项目名称:otp,代码行数:7,代码来源:wxe_return.cpp
示例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;
}
开发者ID:juaristi,项目名称:filezilla,代码行数:32,代码来源:updater.cpp
示例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);
}
开发者ID:idanceyang,项目名称:DynaMechs,代码行数:27,代码来源:HumanoidDataLogger.cpp
示例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;
}
开发者ID:joeri,项目名称:e,代码行数:33,代码来源:eDocumentPath.cpp
示例7: SetUtcTime
void DashboardInstrument_Moon::SetUtcTime( wxDateTime data )
{
if (data.IsValid())
{
m_phase = moon_phase(data.GetYear(), data.GetMonth() + 1, data.GetDay());
}
}
开发者ID:mookiejones,项目名称:OpenCPN,代码行数:7,代码来源:clock.cpp
示例8: wxQtConvertDate
QDate wxQtConvertDate(const wxDateTime& date)
{
if ( date.IsValid() )
return QDate(date.GetYear(), date.GetMonth() + 1, date.GetDay());
else
return QDate();
}
开发者ID:EEmmanuel7,项目名称:wxWidgets,代码行数:7,代码来源:converter.cpp
示例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);
}
开发者ID:SamsonovAnton,项目名称:OpenCPN,代码行数:8,代码来源:Track.cpp
示例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));
}
开发者ID:xiul,项目名称:Database-Designer-for-pgAdmin,代码行数:9,代码来源:pgsDateTimeGen.cpp
示例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
}
开发者ID:Th0rN13,项目名称:kicad-source-mirror,代码行数:10,代码来源:common.cpp
示例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;
}
开发者ID:Rasbats,项目名称:otcurrent_pi,代码行数:10,代码来源:otcurrentUIDialog.cpp
示例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());
}
}
开发者ID:vomikan,项目名称:moneymanagerex,代码行数:10,代码来源:budget.cpp
示例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);
}
开发者ID:lukecian,项目名称:wxfreechart,代码行数:12,代码来源:compdateaxis.cpp
示例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));
}
开发者ID:lhcezar,项目名称:pgadmin3,代码行数:12,代码来源:pgsTimeGen.cpp
示例16: MSWGetControlValue
wxDateTime wxDatePickerCtrl::GetValue() const
{
#if wxDEBUG_LEVEL
const wxDateTime dt = MSWGetControlValue();
wxASSERT_MSG( m_date.IsValid() == dt.IsValid() &&
(!dt.IsValid() || dt == m_date),
wxT("bug in wxDateTimePickerCtrl: m_date not in sync") );
#endif // wxDEBUG_LEVEL
return wxDateTimePickerCtrl::GetValue();
}
开发者ID:nE0sIghT,项目名称:wxWidgets,代码行数:12,代码来源:datectrl.cpp
示例17:
bool
wxGtkCalendarCtrl::SetDateRange(const wxDateTime& lowerdate,
const wxDateTime& upperdate)
{
if ( lowerdate.IsValid() && upperdate.IsValid() && lowerdate >= upperdate )
return false;
m_validStart = lowerdate;
m_validEnd = upperdate;
return true;
}
开发者ID:iokto,项目名称:newton-dynamics,代码行数:12,代码来源:calctrl.cpp
示例18: ComputeDayTime
/* this is not actually all that accurate (no oblate earth, refraction etc...
but it's at least simple, could fix and optimize to only compute if
there are possible plans which need this */
static bool ComputeDayTime(const wxDateTime &gribtime, double lat, double lon, int &daytime)
{
if(daytime != -1)
return daytime != 0;
double yearpos = 2*M_PI*(gribtime.GetDay()-186)/365.24;
double gha = 2*M_PI*(lon/15 - gribtime.GetHour() - gribtime.GetMinute()/60)/24;
double suninc = 90*cos(deg2rad(lat))*sin(gha) + 23.45*cos(yearpos);
return (daytime = (suninc > 0)) != 0; /* sun above horizon */
}
开发者ID:did-g,项目名称:weather_routing_pi,代码行数:15,代码来源:BoatPlan.cpp
示例19: SetStartDateTime
void ConfigurationDialog::SetStartDateTime(wxDateTime datetime)
{
if(datetime.IsValid()) {
m_dpStartDate->SetValue(datetime);
m_tStartHour->SetValue(wxString::Format(_T("%.3f"), datetime.GetHour()
+datetime.GetMinute() / 60.0));
} else {
wxMessageDialog mdlg(this, _("Invalid Date Time."),
wxString(_("Weather Routing"), wxOK | wxICON_WARNING));
mdlg.ShowModal();
}
}
开发者ID:Rasbats,项目名称:OpenCPN.3.3.1117_weather_routing,代码行数:12,代码来源:ConfigurationDialog.cpp
示例20: FormatDateTime
wxString nwxString::FormatDateTime(const wxDateTime &dt, const wxString &sDefault)
{
wxString sRtn;
if(dt.GetTicks() == 0)
{
sRtn = sDefault;
}
else
{
sRtn = dt.Format(nwxString::TIME_FORMAT);
}
return sRtn;
}
开发者ID:HelloWilliam,项目名称:osiris,代码行数:13,代码来源:nwxString.cpp
注:本文中的wxDateTime类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论