SyncClock.cpp
资源名称:停车场管理系统.zip [点击查看]
上传用户:trilite
上传日期:2007-04-24
资源大小:261k
文件大小:2k
源码类别:
酒店行业
开发平台:
Visual C++
- // SyncClock.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ParkSys.h"
- #include "SyncClock.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CSyncClock
- IMPLEMENT_DYNAMIC(CSyncClock, CRecordset)
- CSyncClock::CSyncClock(CDatabase* pdb)
- : CRecordset(pdb)
- {
- //{{AFX_FIELD_INIT(CSyncClock)
- m_nFields = 1;
- //}}AFX_FIELD_INIT
- m_nDefaultType = snapshot;
- }
- CString CSyncClock::GetDefaultConnect()
- {
- CString str;
- str.LoadString(IDS_DATABASE_DSN);
- return str;
- }
- CString CSyncClock::GetDefaultSQL()
- {
- return _T("SELECT GETDATE()");
- }
- void CSyncClock::DoFieldExchange(CFieldExchange* pFX)
- {
- //{{AFX_FIELD_MAP(CSyncClock)
- pFX->SetFieldType(CFieldExchange::outputColumn);
- RFX_Date(pFX, _T("[GETDATE()]"), m_datetimeServer);
- //}}AFX_FIELD_MAP
- }
- /////////////////////////////////////////////////////////////////////////////
- // CSyncClock diagnostics
- #ifdef _DEBUG
- void CSyncClock::AssertValid() const
- {
- CRecordset::AssertValid();
- }
- void CSyncClock::Dump(CDumpContext& dc) const
- {
- CRecordset::Dump(dc);
- }
- #endif //_DEBUG
- void CSyncClock::SetSystemTime(const CTime& time)
- {
- SYSTEMTIME systime;
- systime.wYear = time.GetYear();
- systime.wMonth = time.GetMonth();
- systime.wDay = time.GetDay();
- systime.wHour = time.GetHour();
- systime.wMinute = time.GetMinute();
- systime.wSecond = time.GetSecond();
- systime.wDayOfWeek = time.GetDayOfWeek() - 1;
- systime.wMilliseconds = 0;
- BOOL ret = ::SetLocalTime(&systime);
- ASSERT(ret);
- }