当前位置: 首页>>代码示例>>C++>>正文


C++ CTime::GetAsSystemTime方法代码示例

本文整理汇总了C++中CTime::GetAsSystemTime方法的典型用法代码示例。如果您正苦于以下问题:C++ CTime::GetAsSystemTime方法的具体用法?C++ CTime::GetAsSystemTime怎么用?C++ CTime::GetAsSystemTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CTime的用法示例。


在下文中一共展示了CTime::GetAsSystemTime方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnOK

void CPlayBackByTime::OnOK() 
{
	DeviceNode *pInfo;
	SYSTEMTIME systime;
	NET_TIME stime, etime;
	
	if(!UpdateData(true))
	{
		return;
	}
	if(m_devicesel.GetCount() <= 0 || m_devicesel.GetCurSel() < 0)
	{
		MessageBox(ConvertString(MSG_SCHRECORD_NODEVICE), ConvertString(MSG_SCHRECORD_CHOOSEDEVICE));
		return;
	}
	if(m_channelsel <= 0 || m_channelsel > MAX_CHANNUM)
	{
		MessageBox(ConvertString(MSG_SCHRECORD_CHLNO_INVALID), ConvertString(MSG_SCHRECORD_CHLNO));	
		return;
	}
	/*Begin: Add by yehao(10857) For Check error 2006-12-27*/
	/*if (m_startdate >= m_enddate)
	{
		MessageBox(MSG_SCHRECORD_TIMEINPUT_ERR,MSG_SCHRECORD_TIMEINPUT);
		return;
	}*/
	/*End: yehao(10857) Check error */
	CTime time = CTime(m_startdate.GetYear(),m_startdate.GetMonth(),m_startdate.GetDay(),
		m_starttime.GetHour(), m_starttime.GetMinute(), m_starttime.GetSecond());
	if(!time.GetAsSystemTime(systime) || !time.GetAsSystemTime(systime))
	{
		MessageBox(ConvertString(MSG_SCHRECORD_TIMEINPUT_ERR), ConvertString(MSG_SCHRECORD_TIMEINPUT));
		return;
	}
	g_SysTimetoYwtime(&systime,&stime);
	
	time = CTime(m_enddate.GetYear(),m_enddate.GetMonth(),m_enddate.GetDay(),
		m_endtime.GetHour(), m_endtime.GetMinute(), m_endtime.GetSecond());
	if(!time.GetAsSystemTime(systime) || !time.GetAsSystemTime(systime))
	{
		MessageBox(ConvertString(MSG_SCHRECORD_TIMEINPUT_ERR), ConvertString(MSG_SCHRECORD_TIMEINPUT));
		return;
	}
	g_SysTimetoYwtime(&systime,&etime);

	pInfo = (DeviceNode *)m_devicesel.GetItemData(m_devicesel.GetCurSel());
	
	m_playbackinfo.pDevice = pInfo;
	m_playbackinfo.nChannel = m_channelsel - 1;
	m_playbackinfo.starttime = stime;
	m_playbackinfo.endtime = etime;

	CDialog::OnOK();
}
开发者ID:crashatom,项目名称:phoebemail,代码行数:54,代码来源:PlayBackByTime.cpp

示例2: SetStartDateTime

void CScheduledTask::SetStartDateTime ( const CTime& time )
{
    time.GetAsSystemTime ( m_timeStart );

    m_timeStart.wSecond = 0;
    m_timeStart.wMilliseconds = 0;
}
开发者ID:DjPasco,项目名称:Mag,代码行数:7,代码来源:ScheduledTask.cpp

示例3: ToRelativeTimeString

/**
 *	Converts a given time to a relative display string (relative to current time)
 *	Given time must be in local timezone
 */
CString CLoglistUtils::ToRelativeTimeString(CTime time)
{
	// convert to COleDateTime
	SYSTEMTIME sysTime;
	time.GetAsSystemTime(sysTime);
	COleDateTime oleTime(sysTime);
	return ToRelativeTimeString(oleTime, COleDateTime::GetCurrentTime());
}
开发者ID:15375514460,项目名称:TortoiseGit,代码行数:12,代码来源:LoglistUtils.cpp

示例4: ToRelativeTimeString

/**
 *	Converts a given time to a relative display string (relative to current time)
 *	Given time must be in local timezone
 */
CString CAppUtils::ToRelativeTimeString(CTime time)
{
	CString answer;
	// convert to COleDateTime
	SYSTEMTIME sysTime;
	time.GetAsSystemTime( sysTime );
	COleDateTime oleTime( sysTime );
	answer = ToRelativeTimeString(oleTime, COleDateTime::GetCurrentTime());
	return answer;
}
开发者ID:andmedsantana,项目名称:TortoiseGit,代码行数:14,代码来源:TortoiseGitBlameAppUtils.cpp

示例5: SetSelRange

BOOL CMonthCalCtrl::SetSelRange(const CTime& refMinRange,
                                const CTime& refMaxRange)
{
    // control must have multiple select
    ASSERT((GetStyle() & MCS_MULTISELECT));
    ASSERT(::IsWindow(m_hWnd));

    SYSTEMTIME sysTimes[2];
    BOOL bResult = FALSE;

    if (refMinRange.GetAsSystemTime(sysTimes[0]) &&
            refMaxRange.GetAsSystemTime(sysTimes[1]))
    {
        bResult = (BOOL)
                  ::SendMessage(m_hWnd, MCM_SETSELRANGE, 0, (LPARAM)sysTimes);
    }

    return bResult;
}
开发者ID:pixelspark,项目名称:corespark,代码行数:19,代码来源:winctrl5.cpp

示例6: FormatTime

bool CFileBrowserListCtrl::FormatTime(CTime Time, CString& Str)
{
	static const int MAX_STRING = 64;	// maximum date or time string
	SYSTEMTIME	st;
	Time.GetAsSystemTime(st);
	TCHAR	DateStr[MAX_STRING], TimeStr[MAX_STRING];
	if (!GetDateFormat(0, 0, &st, NULL, DateStr, MAX_STRING))
		return(FALSE);
	if (!GetTimeFormat(0, TIME_NOSECONDS, &st, NULL, TimeStr, MAX_STRING))
		return(FALSE);
	Str = CString(DateStr) + " " + TimeStr;
	return(TRUE);
}
开发者ID:victimofleisure,项目名称:Fractice,代码行数:13,代码来源:FileBrowserListCtrl.cpp

示例7: SetCurSel

BOOL CMonthCalCtrl::SetCurSel(const CTime& refTime)
{
    ASSERT(::IsWindow(m_hWnd));

    SYSTEMTIME sysTime;
    BOOL bRetVal = FALSE;

    if (refTime.GetAsSystemTime(sysTime))
    {
        bRetVal = (BOOL)
                  ::SendMessage(m_hWnd, MCM_SETCURSEL, 0, (LPARAM) &sysTime);
    }

    return bRetVal;
}
开发者ID:pixelspark,项目名称:corespark,代码行数:15,代码来源:winctrl5.cpp

示例8: FormatDateAndTime

/**
 * FUNCTION    :   FormatDateAndTime
 * DESCRIPTION :   Generates a displayable string from a CTime object in
 *                 system short or long format  or as a relative value
 *				   cTime - the time
 *				   option - DATE_SHORTDATE or DATE_LONGDATE
 *				   bIncluedeTime - whether to show time as well as date
 *				   bRelative - if true then relative time is shown if reasonable
 *				   If HKCU\Software\TortoiseGit\UseSystemLocaleForDates is 0 then use fixed format
 *				   rather than locale
 * RETURN      :   CString containing date/time
 */
CString CAppUtils::FormatDateAndTime( const CTime& cTime, DWORD option, bool bIncludeTime /*=true*/,
	bool bRelative /*=false*/)
{
	CString datetime;
	if ( bRelative )
	{
		datetime = ToRelativeTimeString( cTime );
	}
	else
	{
		// should we use the locale settings for formatting the date/time?
		if (CRegDWORD(_T("Software\\TortoiseGit\\UseSystemLocaleForDates"), TRUE))
		{
			// yes
			SYSTEMTIME sysTime;
			cTime.GetAsSystemTime( sysTime );

			TCHAR buf[100];

			GetDateFormat(LOCALE_USER_DEFAULT, option, &sysTime, NULL, buf,
				_countof(buf) - 1);
			datetime = buf;
			if ( bIncludeTime )
			{
				datetime += _T(" ");
				GetTimeFormat(LOCALE_USER_DEFAULT, 0, &sysTime, NULL, buf, _countof(buf) - 1);
				datetime += buf;
			}
		}
		else
		{
			// no, so fixed format
			if ( bIncludeTime )
			{
				datetime = cTime.Format(_T("%Y-%m-%d %H:%M:%S"));
			}
			else
			{
				datetime = cTime.Format(_T("%Y-%m-%d"));
			}
		}
	}
	return datetime;
}
开发者ID:andmedsantana,项目名称:TortoiseGit,代码行数:56,代码来源:TortoiseGitBlameAppUtils.cpp


注:本文中的CTime::GetAsSystemTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。