本文整理汇总了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();
}
示例2: SetStartDateTime
void CScheduledTask::SetStartDateTime ( const CTime& time )
{
time.GetAsSystemTime ( m_timeStart );
m_timeStart.wSecond = 0;
m_timeStart.wMilliseconds = 0;
}
示例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());
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}