本文整理汇总了C++中CTime::GetMinute方法的典型用法代码示例。如果您正苦于以下问题:C++ CTime::GetMinute方法的具体用法?C++ CTime::GetMinute怎么用?C++ CTime::GetMinute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTime
的用法示例。
在下文中一共展示了CTime::GetMinute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPaint
void CLEDClock::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
/*---------------------进行初始化的显示-------------------*/
CRect rectClient;
GetClientRect(&rectClient);
m_h = rectClient.Height();
m_w = rectClient.Width()/8;
CTime time = CTime::GetCurrentTime();
int nh1 = time.GetHour()/10;
if(nh1)
Output(nh1, 0);
else
Output(11, 0);
int nh2 = time.GetHour()%10;
Output(nh2, 1);
int nm1 = time.GetMinute()/10;
Output(nm1, 3);
int nm2 = time.GetMinute()%10;
Output(nm2, 4);
int ns1 = time.GetSecond()/10;
Output(ns1, 6);
int s2 = time.GetSecond()%10;
Output(s2, 7);
Output(10, 2); // double points
Output(10, 5); // double points
// Do not call CStatic::OnPaint() for painting messages
}
示例2: GetEphemerisNmae
CString CGetEphemerisDlg::GetEphemerisNmae()
{
CString f;
CTime t = CTime::GetCurrentTime();
f.Format("NMEA%02d-%02d-%02d_%02d%02d%02d.txt", t.GetYear(), t.GetMonth(), t.GetDay(),
t.GetHour(), t.GetMinute(), t.GetSecond());
switch(ephType)
{
case GpsEphemeris:
f.Format("GPS_Ephemeris%02d-%02d-%02d_%02d%02d%02d.log", t.GetYear(), t.GetMonth(), t.GetDay(),
t.GetHour(), t.GetMinute(), t.GetSecond());
break;
case GlonassEphemeris:
f.Format("Glonass_Ephemeris%02d-%02d-%02d_%02d%02d%02d.log", t.GetYear(), t.GetMonth(), t.GetDay(),
t.GetHour(), t.GetMinute(), t.GetSecond());
break;
case BeidouEphemeris:
f.Format("Beidou_Ephemeris%02d-%02d-%02d_%02d%02d%02d.log", t.GetYear(), t.GetMonth(), t.GetDay(),
t.GetHour(), t.GetMinute(), t.GetSecond());
break;
case GalileoEphemeris:
f.Format("Galileo_Ephemeris%02d-%02d-%02d_%02d%02d%02d.log", t.GetYear(), t.GetMonth(), t.GetDay(),
t.GetHour(), t.GetMinute(), t.GetSecond());
break;
default:
ASSERT(FALSE);
break;
}
return f;
}
示例3: GetNowTime
CTime GetNowTime(short nPeriod)
{
if(nPeriod == PERIOD_TYPE_DAY)
{
CTime now = CTime::GetCurrentTime();
CTime t(now.GetYear(),now.GetMonth(),now.GetDay(),0,0,0);
return t;
}
else if (nPeriod == PERIOD_TYPE_MINUTE1)
{
CTime now = CTime::GetCurrentTime();
CTime t(now.GetYear(),now.GetMonth(),now.GetDay(),now.GetHour(),now.GetMinute(),0);
return t;
}
else if (nPeriod == PERIOD_TYPE_MINUTE5)
{
CTime now = CTime::GetCurrentTime();
int nMinute = now.GetMinute() / 5 * 5;
CTime t(now.GetYear(),now.GetMonth(),now.GetDay(),now.GetHour(),nMinute,0);
return t;
}
else
{
return CTime::GetCurrentTime();
}
}
示例4: WriteLog
BOOL WriteLog(WCHAR *szFile,CTime StartTime,CTime EndTime,BOOL bSucc)
{
CString strText,strResult;
WCHAR szUserName[MAX_PATH],szLogFile[MAX_PATH];
HANDLE hFile;
WORD wUnicodeSign = 0;
ULONG ulEnter = 0x000a000d;
ULONG ulLen = MAX_PATH,dwWrtited;
GetUserName(szUserName,&ulLen);
strResult.LoadString(bSucc?IDS_RESULT_SUCC:IDS_RESULT_FAIL);
strText.Format(IDS_LOG_FORMAT,szFile,szUserName,
StartTime.GetYear(),StartTime.GetMonth(),StartTime.GetDay(),
StartTime.GetHour(),StartTime.GetMinute(),StartTime.GetSecond(),
EndTime.GetYear(),EndTime.GetMonth(),EndTime.GetDay(),
EndTime.GetHour(),EndTime.GetMinute(),EndTime.GetSecond(),
g_nDelMethod, strResult);
////GetSystemDirectory(szLogFile,MAX_PATH);
//ZeroMemory(szLogFile, MAX_PATH * sizeof(WCHAR));
//WCHAR chCurrentProcessName[MAX_PATH];
//WCHAR *pDest = NULL;
//GetModuleFileName(NULL,chCurrentProcessName,MAX_PATH);
//wcscpy(szLogFile,chCurrentProcessName);
//pDest = wcsstr(szLogFile,L"\\DelFile.exe");
//*pDest = L'\0';
CString path;
GetLocalDir(path);
path += L"\\dm.log";
//wcscat(szLogFile,L"\\dm.log");
hFile = CreateFile(path,GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL,
NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
strText.Format(IDS_LOG_FAIL,path);
AfxMessageBox(strText);
return FALSE;
}
ReadFile(hFile,&wUnicodeSign,sizeof(WORD),&dwWrtited,NULL);
if (wUnicodeSign != 0xfeff)
{
wUnicodeSign = 0xfeff;
SetFilePointer(hFile,0,NULL,FILE_BEGIN);
WriteFile(hFile,&wUnicodeSign,sizeof(WORD),&dwWrtited,NULL);
}
else SetFilePointer(hFile,0,NULL,FILE_END);
WriteFile(hFile,strText,strText.GetLength()*sizeof(WCHAR),&dwWrtited,NULL);
WriteFile(hFile,&ulEnter,sizeof(ULONG),&dwWrtited,NULL);
SetEndOfFile(hFile);
CloseHandle(hFile);
return TRUE;
}
示例5: OnTimer
void CLEDClock::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
if(nIDEvent == m_nTimer) {
m_nCount++;
CRect rectClient;
GetClientRect(&rectClient);
m_h = rectClient.Height();
if(m_style == XDC_SECOND) {
m_w = rectClient.Width()/8;
} else {
m_w = rectClient.Width()/5;
}
CTime time = CTime::GetCurrentTime();
int nh1 = time.GetHour()/10;
if(nh1)
Output(nh1, 0);
else
Output(11, 0);
int nh2 = time.GetHour()%10;
Output(nh2, 1);
int nm1 = time.GetMinute()/10;
Output(nm1, 3);
int nm2 = time.GetMinute()%10;
Output(nm2, 4);
switch(m_style) {
case XDC_SECOND:
{
int ns1 = time.GetSecond()/10;
Output(ns1, 6);
int s2 = time.GetSecond()%10;
Output(s2, 7);
Output(10, 2); // double points
Output(10, 5); // double points
}
break;
case XDC_NOSECOND:
default:
if(m_bAlarm)
Output(10, 2);
else
if(m_nCount%2)
Output(10, 2); // double points
else
Output(11, 2); //
break;
}
if(m_bAlarm)
MessageBeep(-1);
}
CStatic::OnTimer(nIDEvent);
}
示例6: WriteLog
BOOL WriteLog(WCHAR *szFile,CTime StartTime,CTime EndTime,BOOL bSucc)
{
CString strText,strResult;
WCHAR szUserName[MAX_PATH];
CString szLogFile;
HANDLE hFile;
WORD wUnicodeSign = 0;
ULONG ulEnter = 0x000a000d;
ULONG ulLen = MAX_PATH,dwWrtited;
GetUserName(szUserName,&ulLen);
strResult.LoadString(bSucc?IDS_RESULT_SUCC:IDS_RESULT_FAIL);
strText.Format(IDS_LOG_FORMAT,szFile,szUserName,
StartTime.GetYear(),StartTime.GetMonth(),StartTime.GetDay(),
StartTime.GetHour(),StartTime.GetMinute(),StartTime.GetSecond(),
EndTime.GetYear(),EndTime.GetMonth(),EndTime.GetDay(),
EndTime.GetHour(),EndTime.GetMinute(),EndTime.GetSecond(),
strResult);
//GetSystemDirectory(szLogFile,MAX_PATH);
GetLocalDir(szLogFile);
szLogFile += L"\\dm.log";
hFile = CreateFile(szLogFile,GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL,
NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
strText.Format(IDS_LOG_FAIL,szLogFile);
AfxMessageBox(strText);
return FALSE;
}
ReadFile(hFile,&wUnicodeSign,sizeof(WORD),&dwWrtited,NULL);
if (wUnicodeSign != 0xfeff)
{
wUnicodeSign = 0xfeff;
SetFilePointer(hFile,0,NULL,FILE_BEGIN);
WriteFile(hFile,&wUnicodeSign,sizeof(WORD),&dwWrtited,NULL);
}
else SetFilePointer(hFile,0,NULL,FILE_END);
WriteFile(hFile,strText.GetBuffer(0),strText.GetLength()*sizeof(WCHAR),&dwWrtited,NULL);
WriteFile(hFile,&ulEnter,sizeof(ULONG),&dwWrtited,NULL);
SetEndOfFile(hFile);
CloseHandle(hFile);
return TRUE;
}
示例7: configure
ICQ_EXPORT void configure(IcqProfile *profile)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CConfigDlg dlg;
dlg.m_enable = alarmEnabled;
dlg.m_date = alarmTime;
dlg.m_time = alarmTime;
dlg.m_text = alarmText.c_str();
if (dlg.DoModal() != IDOK)
return;
alarmEnabled = dlg.m_enable;
alarmTime = CTime(dlg.m_date.GetYear(), dlg.m_date.GetMonth(), dlg.m_date.GetDay(),
dlg.m_time.GetHour(), dlg.m_time.GetMinute(), dlg.m_time.GetSecond());
alarmText = dlg.m_text;
profile->writeBool("enable", alarmEnabled ? true : false);
profile->writeInt("year", alarmTime.GetYear());
profile->writeInt("month", alarmTime.GetMonth());
profile->writeInt("day", alarmTime.GetDay());
profile->writeInt("hour", alarmTime.GetHour());
profile->writeInt("minute", alarmTime.GetMinute());
profile->writeInt("second", alarmTime.GetSecond());
profile->writeString("text", alarmText.c_str());
if (alarmEnabled)
setTimer(alarmTime);
}
示例8: CTimeToULong
unsigned long CCommClass::CTimeToULong(CTime time)
{
int days[13] = { 0, 31 , 29 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 } ;
int day , i ;
unsigned long seconds ;
seconds = 0 ;
day = 0 ;
bool bLeapYear = time.GetYear()%400 == 0 || ( time.GetYear()%4 == 0 && time.GetYear()%100 != 0 ) ;
if( !bLeapYear )
days[2] = 28 ;
for( i = 0 ; i < ( time.GetYear()-2000 ) ; i++ )
{
bLeapYear = (2000+i)%400 == 0 || ( (2000+i)%4 == 0 && (2000+i)%100 != 0 ) ;
if( bLeapYear )
day += 366 ;
else
day += 365 ;
}
for( i = 1 ; i < time.GetMonth() ; i++ )
{
day += days[i] ;
}
day += ( time.GetDay() - 1 );
seconds = ( day * 24 + time.GetHour() )*3600 + time.GetMinute() * 60 + time.GetSecond() ;
return seconds ;
}
示例9: sizeof
void CXuser32App::LogMessage(LPCTSTR pszLog, BOOL bShowTime)
{
CFile pFile;
if ( pFile.Open( _T("Xuser32.log"), CFile::modeReadWrite ) )
{
pFile.Seek( 0, CFile::end );
}
else
{
if ( ! pFile.Open( _T("Xuser32.log"), CFile::modeWrite|CFile::modeCreate ) ) return;
}
if ( bShowTime )
{
CTime pNow = CTime::GetCurrentTime();
CString strLine;
strLine.Format( _T("[%.2i:%.2i:%.2i] %s\r\n"),
pNow.GetHour(), pNow.GetMinute(), pNow.GetSecond(), pszLog );
pFile.Write( (LPCTSTR)strLine, sizeof(TCHAR) * strLine.GetLength() );
}
else
{
pFile.Write( pszLog, sizeof(TCHAR) * _tcslen(pszLog) );
pFile.Write( _T("\r\n"), sizeof(TCHAR) * 2 );
}
pFile.Close();
}
示例10: AfxTimeToFileTime
void AFX_CDECL AfxTimeToFileTime(const CTime& time, LPFILETIME pFileTime)
{
ASSERT(pFileTime != NULL);
if (pFileTime == NULL)
{
AfxThrowInvalidArgException();
}
SYSTEMTIME sysTime;
sysTime.wYear = (WORD)time.GetYear();
sysTime.wMonth = (WORD)time.GetMonth();
sysTime.wDay = (WORD)time.GetDay();
sysTime.wHour = (WORD)time.GetHour();
sysTime.wMinute = (WORD)time.GetMinute();
sysTime.wSecond = (WORD)time.GetSecond();
sysTime.wMilliseconds = 0;
// convert system time to local file time
FILETIME localTime;
if (!SystemTimeToFileTime((LPSYSTEMTIME)&sysTime, &localTime))
CFileException::ThrowOsError((LONG)::GetLastError());
// convert local file time to UTC file time
if (!LocalFileTimeToFileTime(&localTime, pFileTime))
CFileException::ThrowOsError((LONG)::GetLastError());
}
示例11: TickTimerHappyHour
void cHappyHour::TickTimerHappyHour()
{
if (HappyHourEnabled == 0) return;
CTime t = CTime::GetCurrentTime();
int Hour = t.GetHour();
int Min = t.GetMinute();
int WeekDay = t.GetDayOfWeek();
if (!t.GetSecond())
{
for (int i=0; i<HappyHoursNumber; i++)
{
if (Hour == HappyStruct[i].S_Hour && Min == HappyStruct[i].S_Min && (WeekDay == HappyStruct[i].S_WeekDay || HappyStruct[i].S_WeekDay == -1))
{
Chat.MessageAll(0,0,NULL,"[Happy Hour] %s Event Started. Event Close in %d:%02d.",
Utilits.GetMapName(HappyStruct[i].MapNum),HappyStruct[i].C_Hour,HappyStruct[i].C_Min);
HappyStruct[i].Started = true;
}
if (Hour == HappyStruct[i].C_Hour && Min == HappyStruct[i].C_Min && (WeekDay == HappyStruct[i].C_WeekDay || HappyStruct[i].C_WeekDay == -1))
{
Chat.MessageAll(0,0,NULL,"[Happy Hour] On %s Event Close.",Utilits.GetMapName(HappyStruct[i].MapNum));
HappyStruct[i].Started = false;
}
CheckNeedMessage(i);
}
}
}
示例12: RepackFile
BOOL CMailChannel::RepackFile(LPCTSTR xFaxFile)
{
CString xNewFile;
SYSTEMTIME pTime;
GetLocalTime( &pTime );
xNewFile.Format( "%04i%02i%02i%02i%02i%02i%03i.tif",
pTime.wYear, pTime.wMonth, pTime.wDay,
pTime.wHour, pTime.wMinute, pTime.wSecond, pTime.wMilliseconds );
int nResult =
fBmp_CutTifHeader( (LPSTR)xFaxFile, xNewFile.GetBuffer(0), 16, -1, 0 );
if ( nResult == -1 ) return FALSE;
CTime pNow = CTime::GetCurrentTime();
CHAR xDateTime[32];
sprintf( xDateTime, "%.4i-%.2i-%.2i %.2i:%.2i:%.2i",
pNow.GetYear(), pNow.GetMonth(), pNow.GetDay(),
pNow.GetHour(), pNow.GetMinute(), pNow.GetSecond() );
nResult =
fBmp_AddTxtToTif( xNewFile.GetBuffer(0), RemoteId, FaxNumber, "",
xDateTime, (LPSTR)xFaxFile, 0 );
if ( nResult == -1 ) return FALSE;
DeleteFile( xNewFile );
return TRUE;
}
示例13: ParseStringToTime
BOOL CSkinSection::ParseStringToTime(const CString &str, CTime &tm)
{
int nLen = str.GetLength();
if ( nLen < 10)
return FALSE;
int nHead = -1;
int nTail = -1;
CTime tmNow = CTime::GetCurrentTime();
int nVal[6] = {tmNow.GetYear(),tmNow.GetMonth(),tmNow.GetDay(),
tmNow.GetHour(),tmNow.GetMinute(),tmNow.GetSecond()};
for (int i=0; i<6; i++)
{
nHead = nTail + 1;
nTail = str.Find(',',nHead + 1);
if (nTail < 0)
nTail = nLen;
nVal[i] = atoi(str.Mid(nHead,nTail - nHead));
}
tm = CTime(nVal[0],nVal[1],nVal[2],nVal[3],nVal[4],nVal[5]);
return TRUE;
}
示例14: WriteTraceLog
/**********************************************************
* 函数名:
* 功能 : 写跟踪日志,用于跟踪程序流程
* 入口参数: buf--日志内容,字符串格式
nValue--参数,可选
* 出口参数:
* 返回值:
* 备注:
***********************************************************/
void CFileManage::WriteTraceLog(const char *szFileName, const char *buf, int nValue)
{
FILE *fp;
char filePath[200] = {0};
char szTmp[200] = {0};
CTime currentTime = CTime::GetCurrentTime();
int nYear = currentTime.GetYear();
int nMonth = currentTime.GetMonth();
int nDay = currentTime.GetDay();
int nHour = currentTime.GetHour();
int nMinute = currentTime.GetMinute();
int nSecond = currentTime.GetSecond();
strcat(szTmp, szFileName);
strcat(szTmp, "%04d%02d%02d.log");
sprintf(filePath,szTmp,nYear,nMonth,nDay);
fp=fopen(filePath,"at");
if (fp == NULL)
{
if((fp = fopen(filePath, "wt") ) == NULL)//没有就新建一件文件
{
return;
}
}
fprintf(fp,"%02d:%02d:%02d %s: %d\n",nHour,nMinute,nSecond,buf,nValue);
fclose(fp);
}
示例15: OnTimer
void CMainFrame::OnTimer(UINT_PTR nIDEvent)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
switch(nIDEvent)
{
case AUTOSHUTDOWN:
CTime currTime = CTime::GetCurrentTime();
if(theApp.m_logicVariables.IsAutoCloseComputer)
{
CString strCurrtime;
strCurrtime.Format(_T("%d:%d:%d"),currTime.GetHour(),currTime.GetMinute(),
currTime.GetSecond());
CString strCloseComputerTime;
strCloseComputerTime.Format(_T("%d:%d:%d"),theApp.m_logicVariables.CloseComputerTime.GetHour(),
theApp.m_logicVariables.CloseComputerTime.GetMinute(),
theApp.m_logicVariables.CloseComputerTime.GetSecond());
if(strCurrtime==strCloseComputerTime)
{
ShutDown();
}
}
break;
}
CFrameWnd::OnTimer(nIDEvent);
}