本文整理汇总了C++中CTimeSpan::GetDays方法的典型用法代码示例。如果您正苦于以下问题:C++ CTimeSpan::GetDays方法的具体用法?C++ CTimeSpan::GetDays怎么用?C++ CTimeSpan::GetDays使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTimeSpan
的用法示例。
在下文中一共展示了CTimeSpan::GetDays方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetYOffset
int ScheduleViewEx::GetYOffset() const
{
Periods& periods = static_cast<CScheduleApp*>(AfxGetApp())->m_periods;
Period& period = periods.GetCurrentPeriod();
CTimeSpan span = period.m_dateRange.GetEndDate() -
period.m_dateRange.GetStartDate();
int numberOfXPages = (int)(span.GetDays() / xDelta);
if (span.GetDays() % xDelta) // if a partial page, then add 1
numberOfXPages++;
int yOffset = m_offset / numberOfXPages;
return yOffset;
}
示例2: EnableCrashHandler
void CTortoiseProcApp::EnableCrashHandler()
{
// the crash handler is enabled by default, but we disable it
// after 3 months after a release
#define YEAR ((((__DATE__ [7] - '0') * 10 + (__DATE__ [8] - '0')) * 10 \
+ (__DATE__ [9] - '0')) * 10 + (__DATE__ [10] - '0'))
#define MONTH (__DATE__ [2] == 'n' ? (__DATE__ [1] == 'a' ? 1 : 6) \
: __DATE__ [2] == 'b' ? 2 \
: __DATE__ [2] == 'r' ? (__DATE__ [0] == 'M' ? 3 : 4) \
: __DATE__ [2] == 'y' ? 5 \
: __DATE__ [2] == 'l' ? 7 \
: __DATE__ [2] == 'g' ? 8 \
: __DATE__ [2] == 'p' ? 9 \
: __DATE__ [2] == 't' ? 10 \
: __DATE__ [2] == 'v' ? 11 : 12)
#define DAY ((__DATE__ [4] == ' ' ? 0 : __DATE__ [4] - '0') * 10 \
+ (__DATE__ [5] - '0'))
#define DATE_AS_INT (((YEAR - 2000) * 12 + MONTH) * 31 + DAY)
CTime compiletime(YEAR, MONTH, DAY, 0, 0, 0);
CTime now = CTime::GetCurrentTime();
CTimeSpan timediff = now-compiletime;
if (timediff.GetDays() > 3*31)
{
// crasher.Enable(FALSE);
}
}
示例3: DelOldLog
//
// 機能 : 古いログの削除
//
// 機能説明 : LOG_EXPIRE 日以上前のログは削除
//
// 返り値 : true 正常終了
// false エラー発生
//
// 備考 :
//
bool CTPerror::DelOldLog()
{
CString str;
CFileFind finder;
CTime ntm;
CTime tm;
CTimeSpan tms;
CFileSpec fs;
/// LOG_EXPIRE期間以前のログファイルを削除
if (!SetCurrentDirectory(LogDir)) return false;
ntm = CTime::GetCurrentTime();
BOOL bWorking = finder.FindFile(_T("*.log"));
if (!bWorking) return false;
str.Empty();
while (bWorking)
{
bWorking = finder.FindNextFile();
if (!finder.IsDirectory()) {
str = finder.GetFileName();
/// ログファイル作成日付と現在との差分
finder.GetCreationTime(tm);
tms = ntm - tm;
if (tms.GetDays() > LOG_EXPIRE) {
fs.SetFullSpec(str);
if (!fs.Exist()) continue;
fs.FileDelete();
}
}
}
finder.Close();
return true;
}
示例4: TotalPages
int ScheduleViewEx::TotalPages() const
{
Periods& periods = static_cast<CScheduleApp*>(AfxGetApp())->m_periods;
Period& period = periods.GetCurrentPeriod();
CTimeSpan span = period.m_dateRange.GetEndDate() -
period.m_dateRange.GetStartDate();
int numberOfXPages = (int)(span.GetDays() / xDelta);
if (span.GetDays() % xDelta) // if a partial page, then add 1
numberOfXPages++;
int numberOfYPages = period.m_data.m_nurses.Size() / yDelta;
if (period.m_data.m_nurses.Size() % yDelta)
numberOfYPages++;
return numberOfXPages * numberOfYPages;
}
示例5: CheckBanBen
void CCenterServerDlg::CheckBanBen()
{
return ;
CString sn ="20071030";////截止日期
long in=atol(sn.GetBuffer (sn.GetLength ()));
if(in<=0)return ;
int y1=atoi(sn.Mid (0,4)),
m1 =atoi(sn.Mid (4,2)),
d1=atoi(sn.Mid (6,2));
CTime t1(y1,m1,d1,0,0,0);
time_t ct;
time( &ct ) ;
CTime t2(ct);
CTimeSpan tsp;
tsp=t2-t1;//// 当前日期 - 截止日期
LONGLONG dd=tsp.GetDays ();
if(t2>t1)//dd > 0)
{
KillTimer(1);
KillTimer(2);
KillTimer(3);
m_CenterServerModule.StoptService();
AfxMessageBox("本软件生命周期到期,请重新联系www.bzw.cn获取升级版本。(此提示并非时间限制,而是说明程序寿命已到,获取升级版本是免费的。)");
CDialog::OnOK ();//theApp.m_pMainWnd->DestroyWindow ();
return ;
}
}
示例6: GetTimeSpanStr
std::string GetTimeSpanStr(CTimeSpan t)
{
std::string strTime;
if (t.GetDays() > 0)
strTime = UtilWin::ToUTF8(t.Format(_T("%D, %H:%M:%S")));
else strTime = UtilWin::ToUTF8(t.Format(_T("%H:%M:%S")));
return strTime;
}
示例7: ClearLogFileByDays
void CKcsLogging::ClearLogFileByDays(int nDay /* = 7 */)
{
CHAR szLogFileName[MAX_PATH * 2] = { 0 };
WIN32_FIND_DATAA fd = { 0 };
HANDLE hFile = INVALID_HANDLE_VALUE;
SHGetSpecialFolderPathA(NULL, szLogFileName, CSIDL_LOCAL_APPDATA, FALSE);
PathAppendA(szLogFileName, "KSafe\\KClear\\Logs");
PathAppendA(szLogFileName, "*.*");
hFile = FindFirstFileA(szLogFileName, &fd);
if (INVALID_HANDLE_VALUE == hFile)
{
goto Clear0;
}
do
{
if (0 == stricmp(".", fd.cFileName) || 0 == stricmp("..", fd.cFileName))
continue;
time_t lNow = 0;
time(&lNow);
FILETIME localfiletime;
FileTimeToLocalFileTime(&(fd.ftLastWriteTime), &localfiletime);
CTime stSys(lNow);
CTime stFile(localfiletime);
CTimeSpan stSPan;
stSPan = stSys - stFile;
if (stSPan.GetDays() >= nDay)
{
CStringA strtemp = szLogFileName ;
CStringA strFileName = strtemp.Left(strtemp.ReverseFind(L'\\') + 1);
strFileName += fd.cFileName;
if (::PathFileExistsA(strFileName))
{
::DeleteFileA(strFileName);
}
}
} while (FindNextFileA(hFile, &fd));
Clear0:
if (hFile != INVALID_HANDLE_VALUE)
{
FindClose(hFile);
hFile = INVALID_HANDLE_VALUE;
}
}
示例8: GetElapsedDays
int GetElapsedDays (int yy,int mm,int dd)
{
CTime curr;
curr =CTime::GetCurrentTime();
CTime from(curr.GetYear(),curr.GetMonth(),curr.GetDay(),24,0,0);
CTime to(yy,mm,dd,24,0,0);
CTimeSpan elapsedTime = to - from;
return elapsedTime.GetDays();
}
示例9: GetDays
int GetDays(tm ToDay)
{
CTime from;
from =CTime::GetCurrentTime();
CTime to(ToDay.tm_year,ToDay.tm_mon,ToDay.tm_mday,0,0,0);
CTimeSpan elapsedTime = to - from;
return elapsedTime.GetDays();
}
示例10: OnInitDialog
BOOL CFilterPasswordDlg::OnInitDialog()
{
CFilterBaseDlg::OnInitDialog();
CString cs_text;
// NOTE: This ComboBox is NOT sorted by design !
if (m_cbxRule.GetCount() == 0) {
const PWSMatch::MatchRule mrx[] = {PWSMatch::MR_EQUALS, PWSMatch::MR_NOTEQUAL,
PWSMatch::MR_BEGINS, PWSMatch::MR_NOTBEGIN,
PWSMatch::MR_ENDS, PWSMatch::MR_NOTEND,
PWSMatch::MR_CONTAINS, PWSMatch::MR_NOTCONTAIN,
PWSMatch::MR_CNTNANY, PWSMatch::MR_NOTCNTNANY,
PWSMatch::MR_CNTNALL, PWSMatch::MR_NOTCNTNALL,
PWSMatch::MR_EXPIRED, PWSMatch::MR_WILLEXPIRE};
for (size_t i = 0; i < _countof(mrx); i++) {
UINT iumsg = PWSMatch::GetRule(mrx[i]);
cs_text.LoadString(iumsg);
int iItem = m_cbxRule.AddString(cs_text);
m_cbxRule.SetItemData(iItem, mrx[i]);
m_rule2selection[mrx[i]] = iItem;
}
}
int isel = m_rule2selection[(int)m_rule];
if (isel == -1)
m_rule = PWSMatch::MR_INVALID;
if (m_rule != PWSMatch::MR_INVALID) {
m_cbxRule.SetCurSel(isel);
EnableDialogItems();
} else
m_cbxRule.SetCurSel(-1);
// Last 32-bit date is 03:14:07 UTC on Tuesday, January 19, 2038
// Find number of days from now to 2038/01/18 = max value here
const CTime ct_Latest(2038, 1, 18, 0, 0, 0);
const CTime ct_Now(CTime::GetCurrentTime());
CTimeSpan elapsedTime = ct_Latest - ct_Now;
m_maxDays = (int)elapsedTime.GetDays();
UpdateData(FALSE);
return TRUE;
}
示例11: ClearSomeLogfile
/*Delete the logfiles two days ago */
BOOL CFileLogWriter::ClearSomeLogfile( )
{
WCHAR szLogFileName[MAX_PATH] = { 0 };
GetModuleFileName(NULL, szLogFileName, MAX_PATH);
PathRemoveFileSpec(szLogFileName);
PathAppend(szLogFileName, L"log\\*.*");
WIN32_FIND_DATA fd = { 0 };
HANDLE hFile = FindFirstFile(szLogFileName, &fd);
if (INVALID_HANDLE_VALUE == hFile)
{
return FALSE;
}
do
{
if (0 == _wcsicmp(L".", fd.cFileName) || 0 == _wcsicmp(L"..", fd.cFileName))
continue;
time_t lNow = 0;
time(&lNow);
FILETIME localfiletime;
FileTimeToLocalFileTime(&(fd.ftLastWriteTime), &localfiletime);
CTime stSys(lNow);
CTime stFile(localfiletime);
CTimeSpan stSPan;
stSPan = stSys - stFile;
if (stSPan.GetDays() > 6)
{
CString strtemp = szLogFileName ;
CString strFileName = strtemp.Left(strtemp.ReverseFind(L'\\') + 1);
strFileName += fd.cFileName;
ClearLog(strFileName);
}
} while (FindNextFile(hFile, &fd));
FindClose(hFile);
return TRUE;
}
示例12: OnLoad
void CXfilterDlg::OnLoad()
{
IpFilterDriver.init(IP_FILTER_DRIVER_NAME, FILE_ATTRIBUTE_NORMAL);
CString s;
CTime time = CTime::GetCurrentTime();
CTimeSpan ts;
CTime t(0);
ts = time - t;
s.Format("CurrentTime: %u, %s DayCount:%u, TotalSec:%u, Week: %u\n"
, CTime::GetCurrentTime().GetTime()
, time.Format("%Y-%m-%d %H:%M:%S")
, ts.GetDays()
, ts.GetTotalSeconds()
, time.GetDayOfWeek());
// OutputDebugString(s);
if (IpFilterDriver.getError() != NO_ERROR)
AfxMessageBox(_T("Can't load IpFilter Driver"));
}
示例13: DownloadNetCommand
int CHttpRequest::DownloadNetCommand(BYTE bUpdateInterval, BOOL IsSyn)
{
int iRet = XERR_UPDATE_INTERVAL_INVALID;
// DWORD dwFlags;
// if(!InternetGetConnectedState(&dwFlags, 0))
// return XERR_CURRENT_NOT_ONLINE;
if(bUpdateInterval >= 100)
return XERR_UPDATE_INTERVAL_INVALID;
memset(&m_CommandHeader, 0, sizeof(XNET_COMMAND_HEADER));
m_Install.ReadReg(REG_NET_COMMAND_HEADER_ITEM
, (BYTE*)&m_CommandHeader, sizeof(XNET_COMMAND_HEADER));
//
// 2002/12/20 Modify for v2.1.0
//
CTimeSpan ts = CTime::GetCurrentTime() - m_CommandHeader.tCheckTime;
int IntervalDays = ts.GetDays();
if( bUpdateInterval == 0 || m_CommandHeader.tCheckTime == 0
|| IntervalDays >= bUpdateInterval)
{
if(m_CommandHeader.tCheckTime != 0)
{
CString String, Message, Caption;
Caption.LoadString(IDS_CAPTION);
if(bUpdateInterval != 0)
{
String.LoadString(IDS_UPDATE_MESSAGE);
Message.Format(String, IntervalDays);
int iAsk = ::MessageBox(NULL, Message, Caption, MB_YESNO | MB_ICONQUESTION);
if(iAsk == IDNO)
return XERR_REGISTER_DLG_CANCEL;
}
CShell m_Shell;
if(m_Shell.RunProgram(PROGRAM_UPDATE) != SHELL_ERROR_SUCCESS)
{
Message.LoadString(IDS_ERROR_CANT_RUN_FILUP);
::MessageBox(NULL, Message, Caption, MB_OK | MB_ICONWARNING);
return XERR_REGISTER_DLG_CANCEL;
}
}
m_CommandHeader.tCheckTime = CTime::GetCurrentTime();
m_Install.SaveReg(REG_NET_COMMAND_HEADER_ITEM, (BYTE*)&m_CommandHeader, sizeof(XNET_COMMAND_HEADER));
iRet = XERR_SUCCESS;
//
// 2002/12/20 remove for v2.1.0
//
/*
sprintf(m_pUrlRequest, NET_COMMAND_URL);
if(IsSyn)
{
iRet = DownloadCommandFile(this);
}
else
{
DWORD dwThreadId;
m_DownloadThread = ::CreateThread(NULL
, 0, DownloadCommandFile, this, 0, &dwThreadId);
m_CommandHeader.tCheckTime = CTime::GetCurrentTime();
m_Install.SaveReg(REG_NET_COMMAND_HEADER_ITEM,
(BYTE*)&m_CommandHeader, sizeof(XNET_COMMAND_HEADER));
iRet = XERR_STATUS_PENDING;
}
//*/
}
return iRet;
}
示例14: ParseCaHtmlFlights
//.........这里部分代码省略.........
{
if (uRemainTicket > m_nMinTicketWarnNum)
{
//当前票的数量充足时,用当前票的数量更新上次解析出的数量
pfindFlight->nRemainSeat = uRemainTicket;
pfindFlight->nPrice = nCurPrice;
pfindFlight = NULL;
}
}
else //(pfindFlight->nPrice <= nCurPrice)
{
if(pfindFlight->nRemainSeat <= m_nMinTicketWarnNum)
{
pfindFlight->nRemainSeat = uRemainTicket;
pfindFlight->nPrice = nCurPrice;
pfindFlight = NULL;
}
}
continue;
}
//保存解析出来的航班信息,调用者负责释放内存
if (bValid)
{
SCaLowPriceFlightDetail* pDetail = new SCaLowPriceFlightDetail;
pDetail->straCompany = "CA";
pDetail->straFromCityCode = straDPortCode;
pDetail->straToCityCode = straAPortCode;
pDetail->straFlightNo = straFlightNo;
pDetail->straFromDate = straFlightStartDate;
//由于携程订单进入需要一定的时间,国航下班16:00下班,所以当天的票,第2天12:00之前的票,销售结束时间提前30分钟,
//取销售间隔
int nSaleEndYear = 2014;
int nSaleEndMonth = 12;
int nSaleEndDay = 12;
GetYearMonthDay(straSaleEndDate, &nSaleEndYear, &nSaleEndMonth, &nSaleEndDay);
int nSaleEndHour = 12;
int nSaleEndMin = 0;
GetHourMinSec(straSaleEndTime, &nSaleEndHour, &nSaleEndMin);
CTime tSaleEndDate(nSaleEndYear, nSaleEndMonth, nSaleEndDay, nSaleEndHour, nSaleEndMin, 0);
CTimeSpan tSpan = tSaleEndDate - tCurrent;
//end 取销售间隔
//得到起飞时间
int nFlightStartHour = 12;
int nFlightStartMin = 0;
GetHourMinSec(straFlightStartTime, &nFlightStartHour, &nFlightStartMin);
CTime tFlightStartTime(nFlightStartYear, nFlightStartMonth, nFlightStartDay, nFlightStartHour, nFlightStartMin, 0);
CTime tTimeKey(nFlightStartYear, nFlightStartMonth, nFlightStartDay, 12, 0, 0);
//end 得到起飞时间
//今明两天的、起飞时间在12点之前、且是低价申请的,销售结束时间为 前一天的官网销售结束的前30分钟
if ((CA_TUAN_LOW_PRICE_APPLY_PRODUT == pLowPriceFlightInfo->iProductType) && (1 == tSpan.GetDays()))//明天的的低价申请
{
if(tFlightStartTime <= tTimeKey)//明天12起飞的低价申请, 今天下午3:25前有效(国航4点下班)
{
pDetail->straSaleEndDate.Format("%d-%02d-%02d", tCurrent.GetYear(), tCurrent.GetMonth(), tCurrent.GetDay());
CTime tSaleEnd(tCurrent.GetYear(), tCurrent.GetMonth(), tCurrent.GetDay(), 15, 25, 0);
pDetail->straSaleEndTime.Format("%02d:%02d:%02d", tSaleEnd.GetHour(), tSaleEnd.GetMinute(), 0);
}
else//明天12后起飞的低价申请,明早可以出票
{
pDetail->straSaleEndDate = straSaleEndDate;
pDetail->straSaleEndTime.Format("%02d:%02d:%02d", nSaleEndHour, nSaleEndMin, 0);
}
}
else if ((CA_TUAN_LOW_PRICE_APPLY_PRODUT == pLowPriceFlightInfo->iProductType) && (tSpan.GetDays() < 1))//今天的的低价申请,今天下午3:30前有效(国航4点下班)
{
pDetail->straSaleEndDate.Format("%d-%02d-%02d", tCurrent.GetYear(), tCurrent.GetMonth(), tCurrent.GetDay());
CTime tSaleEnd(tCurrent.GetYear(), tCurrent.GetMonth(), tCurrent.GetDay(), 15, 30, 0);
pDetail->straSaleEndTime.Format("%02d:%02d:%02d", tSaleEnd.GetHour(), tSaleEnd.GetMinute(), 0);
}
else//普通团购,后天及以后的低价申请
{
pDetail->straSaleEndDate = straSaleEndDate;
pDetail->straSaleEndTime.Format("%02d:%02d:%02d", nSaleEndHour, nSaleEndMin, 0);
}
//政策销售时间到,删除政策
GetYearMonthDay(pDetail->straSaleEndDate, &nSaleEndYear, &nSaleEndMonth, &nSaleEndDay);
int nSaleEndSec = 0;
GetHourMinSec(pDetail->straSaleEndTime, &nSaleEndHour, &nSaleEndMin, &nSaleEndSec);
CTime tPolicyDeleteTime(nSaleEndYear, nSaleEndMonth, nSaleEndDay, nSaleEndHour, nSaleEndMin, nSaleEndSec);
if (tCurrent >= tPolicyDeleteTime)
uRemainTicket = 0;
pDetail->nPrice = uPrice;
pDetail->nProductId = pLowPriceFlightInfo->iProductId;
pDetail->nRemainSeat = uRemainTicket;
pDetail->nProductType = pLowPriceFlightInfo->iProductType;
listFlight.push_back(pDetail);
}
}
}
tidyRelease(doc);
return -1.0;
}
示例15: tNow
CCustomerStatistics::CCustomerStatistics(long lAsID, CAuctionCtrl* pActl, CMC* pMC) // oikea konstruktori
{
m_pActl = pActl;
::SetCursor(::LoadCursor(NULL, IDC_WAIT));
double dM = 0;
double dY = 0;
double dA = 0;
m_iLoansInAuction = 0;
m_dAuctionDeficit = 0;
m_dAuctionBalance = 0;
m_dPayableAuctionBalance = 0;
m_dAuctionSum = 0;
CTime t = CTime::GetCurrentTime();
CTime tNow((t.GetYear()), (t.GetMonth()), (t.GetDay()), 0,0,0);
CTimeSpan ts;
CHKLainatRS* pALrs = pMC->m_pDB->getAuctionLoanRS();
//pALrs->m_strFilter.Format("HKL_AsID = %ld and HKL_Kuittaus = 1 and HKL_YlijMaksuPv is null and HKL_YlijKuittausPv is null", lAsID);
pALrs->m_strFilter.Format("HKL_AsID = %ld", lAsID);
//pALrs->m_strFilter.Format("HKL_AsID = %ld", lAsID);
try
{
pALrs->Open();
while (!pALrs->IsEOF())
{
m_iLoansInAuction++;
// kaikki huutokaupassa olevien lainojen summa
if (!pALrs->IsFieldNull(&pALrs->m_HKL_Laina))
{
dM = pALrs->m_HKL_Laina;
m_dAuctionSum = m_dAuctionSum + pALrs->m_HKL_Laina;
}
if (!pALrs->IsFieldNull(&pALrs->m_HKL_KorotKulut))
{
dM = dM + pALrs->m_HKL_KorotKulut;
}
if (!pALrs->IsFieldNull(&pALrs->m_HKL_HKkulut))
{
dM = dM + pALrs->m_HKL_HKkulut;
}
// -- ylijäämä ---
if (!pALrs->IsFieldNull(&pALrs->m_HKL_Myyntihinta))
{
if (dM < pALrs->m_HKL_Myyntihinta) // ylijäämä
{
dY = pALrs->m_HKL_Myyntihinta - dM;
m_dAuctionBalance = m_dAuctionBalance + dY;
//
//
//if (hklaina >1v ja maksamaton)
ts = tNow - pALrs->m_HKL_MyyntiPv;
//
/*TRACE("Myynnistä aikaa %ld vrk\n", ts.GetDays());
if( pALrs->m_HKL_Kuittaus == TRUE)
TRACE("pALrs->m_HKL_Kuittaus == TRUE\n");
TRACE("Laina-kulut= %7.2f\n", dY);
if( pALrs->IsFieldNull(&pALrs->m_HKL_YlijKuittausPv))
TRACE("pALrs->m_HKL_YlijKuittausPv=NULL\n");
if( pALrs->IsFieldNull(&pALrs->m_HKL_YlijMaksuPv))
TRACE("m_HKL_YlijMaksuPv=NULL\n");
*///
//
if ((pALrs->m_HKL_Kuittaus == TRUE) &&
(dY > 0.01) &&
(pALrs->IsFieldNull(&pALrs->m_HKL_YlijKuittausPv)) &&
(pALrs->IsFieldNull(&pALrs->m_HKL_YlijMaksuPv))
)
{
if (ts.GetDays() <= theApp.GetAs()->m_AT_YlijKuitAikaraja)
{
m_dPayableAuctionBalance = m_dPayableAuctionBalance + pALrs->m_HKL_Ylij_Alij;
}
}
}
else // alijäämä
{
dA = dM - pALrs->m_HKL_Myyntihinta;
m_dAuctionDeficit = m_dAuctionDeficit + dA;
}
}
pALrs->MoveNext();
}
pALrs->Close();
}
catch (CDBException* e)
{
AfxMessageBox(e->m_strError);
e->Delete();
pALrs->Close();
}
}