• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetTickCount64函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetTickCount64函数的典型用法代码示例。如果您正苦于以下问题:C++ GetTickCount64函数的具体用法?C++ GetTickCount64怎么用?C++ GetTickCount64使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: WinMain

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

{
	GDIWorker::Init(); //Initialization gdi+
	MSG msg;
	HWND hwnd;
	RECT rect;
	Game* game = new Game();

	WNDCLASS wc;

	wc.style = 0;
	wc.lpfnWndProc = WndProc;
	wc.cbClsExtra = 0L;
	wc.cbWndExtra = 0L;
	wc.hInstance = hInstance;
	wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
	wc.hCursor = LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground = GetStockBrush(BLACK_BRUSH);
	wc.lpszMenuName = NULL;//MAKEINTRESOURSE(IDR_MENU1);
	wc.lpszClassName = L"GameWindow";

	RegisterClass(&wc);
//--------------------------------
	GetClientRect(GetDesktopWindow(), &rect);

	hwnd = CreateWindow(
		L"GameWindow",
		L"Puzzle 14.88",
		WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
		(rect.right / 2) - 300,	20,	600, 600,
		HWND_DESKTOP,
		NULL,
		GetModuleHandle(0),
		game);

	GetClientRect(hwnd, &rect);
	
	ShowWindow(hwnd, nCmdShow);
//--------------------------------		
	
	game->Initialize();
	game->Render();

	while (GetMessage(&msg, NULL, 0, 0))
	{
		int timeStart = (int)GetTickCount64(); 

		TranslateMessage(&msg);
		DispatchMessage(&msg);
		
		while ((GetTickCount64() - timeStart) < MS_PER_FRAME)
		{
			int pause = (MS_PER_FRAME - (GetTickCount64() - timeStart));
			if (pause < 0)
				break;
			Sleep(pause);
		}
	}
	
	ResourceManager::GetInstance().DestroyTextures();
	GDIWorker::Destroy();
	return 0;
}
开发者ID:B9lka,项目名称:PuzzleGame,代码行数:64,代码来源:main.cpp


示例2: WndProc

//
//  FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  PURPOSE:  Processes messages for the main window.
//
//  WM_COMMAND	- process the application menu
//  WM_PAINT	- Paint the main window
//  WM_DESTROY	- post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;
	PAINTSTRUCT ps;
	HDC hdc;

	switch (message)
	{
	case WM_CREATE:
		SetTimer(hWnd, 0, 1000, NULL);
		Director::getDirector().hWnd = hWnd;
		Director::getDirector().playBackgroundMusic();
		std::srand(GetTickCount64());
		
	case WM_COMMAND:
		wmId    = LOWORD(wParam);
		wmEvent = HIWORD(wParam);
		// Parse the menu selections:
		switch (wmId)
		{
		case IDM_ABOUT:
			DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
			break;
		case IDM_EXIT:
			DestroyWindow(hWnd);
			break;
		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
		}
		break;
	case WM_PAINT:
		hdc = BeginPaint(hWnd, &ps);
		Director::getDirector().update();
		EndPaint(hWnd, &ps); 
		break;
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
	case WM_LBUTTONDOWN:
		Director::getDirector().mouseDownEvent();
		break;
	case WM_LBUTTONUP:
		Director::getDirector().mouseUpEvent();
		break;
	case WM_MOUSEMOVE:
		Director::getDirector().mouseX = GET_X_LPARAM(lParam);
		Director::getDirector().mouseY = GET_Y_LPARAM(lParam);
		Director::getDirector().mouseMove();
		break;
	case WM_KEYDOWN:
		switch (wParam)
		{
		case 0x53://S
			Director::getDirector().startGame();
			break;
		case 0x51://Q
			Director::getDirector().stopGame();
			break;
		}
		break;
	case WM_TIMER:
		
		Director::getDirector().timerEvent();
		
		break;
	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return 0;
}
开发者ID:qsz13,项目名称:Dots-Win32,代码行数:80,代码来源:Dots.cpp


示例3: HandleSysCommand

void HandleSysCommand(WPARAM wParam, HWND hwnd)
{
	if (wParam == MOVETOMENU_NEW)
	{
		// abort command, too many commands in a short period of time
		if (nLastCommand > GetTickCount64())
		{
			return;
		}
		Log("Getting RootWindow of %X", hwnd);
		HWND rootHwnd = GetAncestor(hwnd, GA_ROOTOWNER);
		if (rootHwnd != NULL)
		{
			hwnd = rootHwnd;
		}

		Log("Moving %X to new", hwnd);
		IVirtualDesktop *pNewDesktop = nullptr;
		HRESULT hr = pDesktopManagerInternal->CreateDesktopW(&pNewDesktop);
		if (FAILED(hr))
		{
			return;
		}
		GUID id;
		hr = pNewDesktop->GetID(&id);
		if (SUCCEEDED(hr))
		{
			HWND focusHwnd = NULL;
			if (!bSwitchDesktopAfterMove)
			{
				focusHwnd = hwnd;
				do
				{
					focusHwnd = GetNextWindow(focusHwnd, GW_HWNDNEXT);
				} while (focusHwnd && EnumWindowsProc(focusHwnd, NULL));
			}

			Log("pDesktopManager->MoveWindowToDesktop(%X, %X)", hwnd, id);
			hr = pDesktopManager->MoveWindowToDesktop(hwnd, id);
			if (SUCCEEDED(hr))
			{
				if (bSwitchDesktopAfterMove)
				{
					pDesktopManagerInternal->SwitchDesktop(pNewDesktop);
				}
				else if (focusHwnd)
				{
					SetForegroundWindow(focusHwnd);
				}
			}
			else
			{
				Log("Error %d on moving %X to %X", hr, hwnd, id);
			}
		}
		pNewDesktop->Release();
		nLastCommand = GetTickCount64() + COMMAND_TIMEOUT;
	}
	else if (wParam >= MOVETOMENU_START && wParam <= MOVETOMENU_LAST)
	{
		// abort command, too many commands in a short period of time
		if (nLastCommand > GetTickCount64())
		{
			return;
		}
		Log("Getting RootWindow of %X", hwnd);
		HWND rootHwnd = GetAncestor(hwnd, GA_ROOTOWNER);
		if (rootHwnd != NULL)
		{
			hwnd = rootHwnd;
		}

		Log("Moving %X to %X", hwnd, wParam);
		IObjectArray *pObjectArray = nullptr;
		HRESULT hr = pDesktopManagerInternal->GetDesktops(&pObjectArray);
		if (FAILED(hr))
		{
			Log("Failed to get desktops for %X", hwnd);
			return;
		}

		IVirtualDesktop *pDesktop = nullptr;
		if (SUCCEEDED(pObjectArray->GetAt((UINT)wParam - MOVETOMENU_START, __uuidof(IVirtualDesktop), (void**)&pDesktop)))
		{
			GUID id;
			hr = pDesktop->GetID(&id);

			if (SUCCEEDED(hr))
			{
				HWND focusHwnd = NULL;
				if (!bSwitchDesktopAfterMove)
				{
					focusHwnd = hwnd;
					do
					{
						focusHwnd = GetNextWindow(focusHwnd, GW_HWNDNEXT);
					} while (focusHwnd && EnumWindowsProc(focusHwnd, NULL));
				}

				Log("pDesktopManager->MoveWindowToDesktop(%X, %X)", hwnd, id);
//.........这里部分代码省略.........
开发者ID:Eun,项目名称:MoveToDesktop,代码行数:101,代码来源:hook.cpp


示例4: AddPath

bool CDirectoryWatcher::AddPath(const CTGitPath& path, bool bCloseInfoMap)
{
	if (!CGitStatusCache::Instance().IsPathAllowed(path))
		return false;
	if ((!blockedPath.IsEmpty())&&(blockedPath.IsAncestorOf(path)))
	{
		if (GetTickCount64() < blockTickCount)
		{
			CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) _T(": Path %s prevented from being watched\n"), path.GetWinPath());
			return false;
		}
	}

	if (path.GetWinPathString().Find(L":\\RECYCLER\\") >= 0)
		return false;
	if (path.GetWinPathString().Find(L":\\$Recycle.Bin\\") >= 0)
		return false;

	AutoLocker lock(m_critSec);
	for (int i=0; i<watchedPaths.GetCount(); ++i)
	{
		if (watchedPaths[i].IsAncestorOf(path))
			return false;		// already watched (recursively)
	}

	// now check if with the new path we might have a new root
	CTGitPath newroot;
	for (int i=0; i<watchedPaths.GetCount(); ++i)
	{
		const CString& watched = watchedPaths[i].GetWinPathString();
		const CString& sPath = path.GetWinPathString();
		int minlen = min(sPath.GetLength(), watched.GetLength());
		int len = 0;
		for (len = 0; len < minlen; ++len)
		{
			if (watched.GetAt(len) != sPath.GetAt(len))
			{
				if ((len > 1)&&(len < minlen))
				{
					if (sPath.GetAt(len)=='\\')
					{
						newroot = CTGitPath(sPath.Left(len));
					}
					else if (watched.GetAt(len)=='\\')
					{
						newroot = CTGitPath(watched.Left(len));
					}
				}
				break;
			}
		}
		if (len == minlen)
		{
			if (sPath.GetLength() == minlen)
			{
				if (watched.GetLength() > minlen)
				{
					if (watched.GetAt(len)=='\\')
					{
						newroot = path;
					}
					else if (sPath.GetLength() == 3 && sPath[1] == ':')
					{
						newroot = path;
					}
				}
			}
			else
			{
				if (sPath.GetLength() > minlen)
				{
					if (sPath.GetAt(len)=='\\')
					{
						newroot = CTGitPath(watched);
					}
					else if (watched.GetLength() == 3 && watched[1] == ':')
					{
						newroot = CTGitPath(watched);
					}
				}
			}
		}
	}
	if (!newroot.IsEmpty())
	{
		CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) _T(": add path to watch %s\n"), newroot.GetWinPath());
		watchedPaths.AddPath(newroot);
		watchedPaths.RemoveChildren();
		if (bCloseInfoMap)
			ClearInfoMap();

		return true;
	}
	CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) _T(": add path to watch %s\n"), path.GetWinPath());
	watchedPaths.AddPath(path);
	if (bCloseInfoMap)
		ClearInfoMap();

	return true;
}
开发者ID:Teivaz,项目名称:TortoiseGit,代码行数:100,代码来源:DirectoryWatcher.cpp


示例5: sizeof

bool CCacheDlg::GetStatusFromRemoteCache(const CTGitPath& Path, bool bRecursive)
{
	if(!EnsurePipeOpen())
	{
		STARTUPINFO startup = { 0 };
		PROCESS_INFORMATION process = { 0 };
		startup.cb = sizeof(startup);

		CString sCachePath = L"TGitCache.exe";
		if (CreateProcess(sCachePath.GetBuffer(sCachePath.GetLength() + 1), L"", nullptr, nullptr, FALSE, 0, nullptr, nullptr, &startup, &process) == 0)
		{
			// It's not appropriate to do a message box here, because there may be hundreds of calls
			sCachePath.ReleaseBuffer();
			ATLTRACE("Failed to start cache\n");
			return false;
		}
		sCachePath.ReleaseBuffer();

		// Wait for the cache to open
		ULONGLONG endTime = GetTickCount64()+1000;
		while(!EnsurePipeOpen())
		{
			if((GetTickCount64() - endTime) > 0)
			{
				return false;
			}
		}
	}


	DWORD nBytesRead;
	TGITCacheRequest request;
	request.flags = TGITCACHE_FLAGS_NONOTIFICATIONS;
	if(bRecursive)
	{
		request.flags |= TGITCACHE_FLAGS_RECUSIVE_STATUS;
	}
	wcsncpy_s(request.path, Path.GetWinPath(), MAX_PATH);
	SecureZeroMemory(&m_Overlapped, sizeof(OVERLAPPED));
	m_Overlapped.hEvent = m_hEvent;
	// Do the transaction in overlapped mode.
	// That way, if anything happens which might block this call
	// we still can get out of it. We NEVER MUST BLOCK THE SHELL!
	// A blocked shell is a very bad user impression, because users
	// who don't know why it's blocked might find the only solution
	// to such a problem is a reboot and therefore they might loose
	// valuable data.
	// Sure, it would be better to have no situations where the shell
	// even can get blocked, but the timeout of 5 seconds is long enough
	// so that users still recognize that something might be wrong and
	// report back to us so we can investigate further.

	TGITCacheResponse ReturnedStatus;
	BOOL fSuccess = TransactNamedPipe(m_hPipe,
		&request, sizeof(request),
		&ReturnedStatus, sizeof(ReturnedStatus),
		&nBytesRead, &m_Overlapped);

	if (!fSuccess)
	{
		if (GetLastError()!=ERROR_IO_PENDING)
		{
			ClosePipe();
			return false;
		}

		// TransactNamedPipe is working in an overlapped operation.
		// Wait for it to finish
		DWORD dwWait = WaitForSingleObject(m_hEvent, INFINITE);
		if (dwWait == WAIT_OBJECT_0)
		{
			fSuccess = GetOverlappedResult(m_hPipe, &m_Overlapped, &nBytesRead, FALSE);
			return TRUE;
		}
		else
			fSuccess = FALSE;
	}

	ClosePipe();
	return false;
}
开发者ID:YueLinHo,项目名称:TortoiseGit,代码行数:81,代码来源:CacheDlg.cpp


示例6: getMenu

void getMenu(char* displayStatsMenu, int size)
{
	if (size < 400)
	{
		return;
	}

	sprintf_s(displayStatsMenu, size, "AC deleted: %6d Requests made: %6d Last deleted: %6lld seconds ago\0", stats.nrOfDeletions, stats.nrOfRequests, stats.lastDeleted == 0 ? 0 : (GetTickCount64() - stats.lastDeleted) / 1000);
	strcpy_s(displayStatsMenu + 74, size-74, "AI Deleter Settings\0");
	sprintf_s(displayStatsMenu + 94, size - 94, "Slow down check rate by 30 seconds (currently every %5d seconds)\0", conf.requestEveryXSec);
	strcpy_s(displayStatsMenu + 161, size - 161, "Speed up check rate by 30 seconds\0");
	sprintf_s(displayStatsMenu + 195, size - 195, "Increase range by 5000m (currently within %6d meters)\0", conf.radius);
	strcpy_s(displayStatsMenu + 252, size - 252, "Reduce range by 5000m\0");
	sprintf_s(displayStatsMenu + 274, size - 274, "Reduce allowed ETD by 1 hour (currently at most %6.2f hours from now)\0", float(conf.maxetd) / 3600.0);
	strcpy_s(displayStatsMenu + 345, size - 345, "Increase allowed ETD by 1 hour\0");
	strcpy_s(displayStatsMenu + 376, size - 376, "Just close window\0");
}
开发者ID:DKlaper,项目名称:AIDeleter,代码行数:17,代码来源:SimCMain.cpp


示例7: set_repeat_time

static void set_repeat_time(void)
{
	uint64_t ticks = GetTickCount64();
	next_publish_tv = ticks + cfg.repeat_delay.tv_sec*1000 + cfg.repeat_delay.tv_usec/1000;
}
开发者ID:eclipse,项目名称:mosquitto,代码行数:5,代码来源:pub_client.c


示例8:

bool		WinTimer::isUp()
{
	if (this->_t >= GetTickCount64())
		return (true);
	return (false);
}
开发者ID:phoenisis,项目名称:EpiHistory,代码行数:6,代码来源:WinTimer.cpp


示例9: GetTickCount64

void		WinTimer::setTimerAt(int time)
{
	this->_t = GetTickCount64();
	this->_t += time;
}
开发者ID:phoenisis,项目名称:EpiHistory,代码行数:5,代码来源:WinTimer.cpp


示例10: Win32_GetTickCount

static int
Win32_GetTickCount(Jim_Interp *interp, int objc, Jim_Obj * const *objv)
{
    Jim_SetResult(interp, Jim_NewIntObj(interp, GetTickCount64()));
    return JIM_OK;
}
开发者ID:hummypkg,项目名称:jimtcl,代码行数:6,代码来源:jim-win32.c


示例11: gfwx_GetTime

uint64_t gfwx_GetTime(void)
{
	return (uint64_t) GetTickCount64();
}
开发者ID:awakecoding,项目名称:gfwx,代码行数:4,代码来源:gfwx_time.c


示例12: main

int main(int argc, char *argv[])
{
	ERR_VALUE ret = ERR_INTERNAL_ERROR;

	utils_allocator_init(omp_get_num_procs());
	omp_init_lock(&_readCoverageLock);
#ifdef _MSC_VER
	uint64_t startTime = GetTickCount64();
#endif
	ret = options_module_init(37);
	if (ret == ERR_SUCCESS) {
		ret = _init_default_values();
		if (ret == ERR_SUCCESS) {
			ret = options_parse_command_line(argc - 2, argv + 2);
			if (ret == ERR_SUCCESS) {
				PROGRAM_OPTIONS po;
				PROGRAM_STATISTICS st;

				memset(&st, 0, sizeof(st));
				ret = _capture_program_options(&po);
				if (ret == ERR_SUCCESS) {
					omp_set_num_threads(po.OMPThreads);
					const char *cmd = argv[1];
					if (strncmp(cmd, "help", sizeof("help")) == 0) {
						options_print_help();
					} else if (strncmp(cmd, "repair", sizeof("repair")) == 0) {
						size_t refSeqLen = 0;
						FASTA_FILE seqFile;
						char *rsFasta = NULL;

						ret = fasta_load(po.RefSeqFile, &seqFile);
						if (ret == ERR_SUCCESS) {
							ret = fasta_read_seq(&seqFile, &rsFasta, &refSeqLen);
							po.ReferenceSequence = rsFasta;
							if (ret != ERR_SUCCESS)
								fasta_free(&seqFile);
						}

						if (ret == ERR_SUCCESS) {
							ret = utils_calloc(omp_get_num_procs(), sizeof(PUTILS_LOOKASIDE), &_vertexLAs);
							if (ret == ERR_SUCCESS)
								ret = utils_calloc(omp_get_num_procs(), sizeof(PUTILS_LOOKASIDE), &_edgeLAs);

							if (ret == ERR_SUCCESS) {
								ret = utils_calloc(omp_get_num_procs(), sizeof(GEN_ARRAY_ONE_READ), &po.ReadSubArrays);
								if (ret == ERR_SUCCESS) {
									const size_t numThreads = omp_get_num_procs();
									for (size_t i = 0; i < numThreads; ++i) {
										dym_array_init_ONE_READ(po.ReadSubArrays + i, 140);
										_vertexLAs[i] = NULL;
										_edgeLAs[i] = NULL;
									}

									size_t regionCount = 0;
									PACTIVE_REGION regions = NULL;

									ret = input_refseq_to_regions(po.ReferenceSequence, refSeqLen, &regions, &regionCount);
									if (ret == ERR_SUCCESS) {
										const ACTIVE_REGION *pa = NULL;

										pa = regions;
										for (size_t i = 0; i < regionCount; ++i) {
											if (pa->Type == artValid && pa->Length >= po.RegionLength)
												_activeRegionCount += (pa->Length / po.TestStep);

											++pa;
										}

										_activeRegionProcessed = 0;
										pa = regions;
										for (size_t i = 0; i < regionCount; ++i) {
											if (pa->Type == artValid && pa->Length >= po.RegionLength)
												repair_reads_in_parallel(pa, &po);
													
											++pa;
										}

										input_free_regions(regions, regionCount);
									}

									PONE_READ r = po.Reads;
									for (size_t i = 0; i < po.ReadCount; ++i) {
										if (r->NumberOfFixes * 100 / r->ReadSequenceLen <= po.ParseOptions.ReadMaxErrorRate) {
											read_quality_encode(r);
											read_write_sam(stdout, r);
											read_quality_decode(r);
										}

										++r;
									}

									utils_free(rsFasta);
									int i = 0;
#pragma omp parallel for shared (po)
									for (i = 0; i < numThreads; ++i)
										dym_array_finit_ONE_READ(po.ReadSubArrays + i);

									utils_free(po.ReadSubArrays);
								}
							}
//.........这里部分代码省略.........
开发者ID:MartinDrab,项目名称:Genetics,代码行数:101,代码来源:gassm2.c


示例13: Destroy

  bool Win32Window::Initialize(const char* name, size_t width, size_t height)
  {
	Destroy();
	IsMouseInWindow(false);

	parentClassName = name;
	childClassName = parentClassName + "_Child";

	// Work around compile error from not defining "UNICODE" while Chromium does
	const LPSTR idcArrow = MAKEINTRESOURCEA(32512);

	WNDCLASSEXA parentWindowClass = { 0 };
	parentWindowClass.cbSize = sizeof(WNDCLASSEXA);
	parentWindowClass.style = 0;
	parentWindowClass.lpfnWndProc = WndProc;
	parentWindowClass.cbClsExtra = 0;
	parentWindowClass.cbWndExtra = 0;
	parentWindowClass.hInstance = GetModuleHandle(NULL);
	parentWindowClass.hIcon = NULL;
	parentWindowClass.hCursor = LoadCursorA(NULL, idcArrow);
	parentWindowClass.hbrBackground = 0;
	parentWindowClass.lpszMenuName = NULL;
	parentWindowClass.lpszClassName = parentClassName.c_str();
	if (!RegisterClassExA(&parentWindowClass)) {
	  return false;
	}

	WNDCLASSEXA childWindowClass = { 0 };
	childWindowClass.cbSize = sizeof(WNDCLASSEXA);
	childWindowClass.style = CS_OWNDC;
	childWindowClass.lpfnWndProc = WndProc;
	childWindowClass.cbClsExtra = 0;
	childWindowClass.cbWndExtra = 0;
	childWindowClass.hInstance = GetModuleHandle(NULL);
	childWindowClass.hIcon = NULL;
	childWindowClass.hCursor = LoadCursorA(NULL, idcArrow);
	childWindowClass.hbrBackground = 0;
	childWindowClass.lpszMenuName = NULL;
	childWindowClass.lpszClassName = childClassName.c_str();
	if (!RegisterClassExA(&childWindowClass)) {
	  return false;
	}

	DWORD parentStyle = WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SYSMENU;
	DWORD parentExtendedStyle = WS_EX_APPWINDOW;

	RECT sizeRect = { 0, 0, static_cast<LONG>(width), static_cast<LONG>(height) };
	AdjustWindowRectEx(&sizeRect, parentStyle, FALSE, parentExtendedStyle);

	parentWindow = CreateWindowExA(
	  parentExtendedStyle,
	  parentClassName.c_str(),
	  name,
	  parentStyle,
	  CW_USEDEFAULT,
	  CW_USEDEFAULT,
	  sizeRect.right - sizeRect.left,
	  sizeRect.bottom - sizeRect.top,
	  NULL,
	  NULL,
	  GetModuleHandle(NULL),
	  this
	);

	nativeWindow = CreateWindowExA(
	  0,
	  childClassName.c_str(),
	  name,
	  WS_CHILD,
	  0,
	  0,
	  static_cast<int>(width),
	  static_cast<int>(height),
	  parentWindow,
	  NULL,
	  GetModuleHandle(NULL),
	  this
	);

	nativeDisplay = GetDC(nativeWindow);
	if (!nativeDisplay) {
	  Destroy();
	  return false;
	}

	{
	  Event event;
	  event.Type = Event::EVENT_INIT_WINDOW;
	  event.Time = GetTickCount64();
	  PushEvent(event);
	}

	return true;
  }
开发者ID:tn-mai,项目名称:NDKOpenGLES2App,代码行数:94,代码来源:Win32Window.cpp


示例14: DialogEnableWindow

LRESULT CProgressDlg::OnProgressUpdateUI(WPARAM wParam,LPARAM lParam)
{
	if(wParam == MSG_PROGRESSDLG_START)
	{
		m_BufStart = 0 ;
		m_Animate.Play(0, INT_MAX, INT_MAX);
		DialogEnableWindow(IDCANCEL, TRUE);
		if (m_pTaskbarList)
		{
			m_pTaskbarList->SetProgressState(m_hWnd, TBPF_NORMAL);
			m_pTaskbarList->SetProgressValue(m_hWnd, 0, 100);
		}
	}
	if(wParam == MSG_PROGRESSDLG_END || wParam == MSG_PROGRESSDLG_FAILED)
	{
		CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) L": got message: %d\n", wParam);
		ULONGLONG tickSpent = GetTickCount64() - m_startTick;
		CString strEndTime = CLoglistUtils::FormatDateAndTime(CTime::GetCurrentTime(), DATE_SHORTDATE, true, false);

		if(m_bBufferAll)
		{
			m_Databuf.m_critSec.Lock();
			m_Databuf.push_back(0);
			m_Log.SetWindowText(Convert2UnionCode((char*)m_Databuf.data()));
			m_Databuf.m_critSec.Unlock();
		}
		m_BufStart=0;
		m_Databuf.m_critSec.Lock();
		this->m_Databuf.clear();
		m_Databuf.m_critSec.Unlock();

		m_bDone = true;
		m_Animate.Stop();
		m_Progress.SetPos(100);
		this->DialogEnableWindow(IDOK,TRUE);

		m_GitStatus = (DWORD)lParam;
		if (m_GitCmd.IsEmpty() && m_GitCmdList.empty())
			m_GitStatus = (DWORD)-1;

		// detect crashes of perl when performing git svn actions
		if (m_GitStatus == 0 && m_GitCmd.Find(L" svn ") > 1)
		{
			CString log;
			m_Log.GetWindowText(log);
			if (log.GetLength() > 18 && log.Mid(log.GetLength() - 18) == L"perl.exe.stackdump")
				m_GitStatus = (DWORD)-1;
		}

		if (m_PostExecCallback)
		{
			CString extraMsg;
			m_PostExecCallback(m_GitStatus, extraMsg);
			if (!extraMsg.IsEmpty())
			{
				int start = m_Log.GetTextLength();
				m_Log.SetSel(start, start);
				m_Log.ReplaceSel(extraMsg);
			}
		}
		{
			CString text;
			m_Log.GetWindowText(text);
			text.Remove('\r');
			CAppUtils::StyleURLs(text, &m_Log);
		}
		if(this->m_GitStatus)
		{
			if (m_pTaskbarList)
			{
				m_pTaskbarList->SetProgressState(m_hWnd, TBPF_ERROR);
				m_pTaskbarList->SetProgressValue(m_hWnd, 100, 100);
			}
			CString log;
			log.Format(IDS_PROC_PROGRESS_GITUNCLEANEXIT, m_GitStatus);
			CString err;
			if (CRegDWORD(L"Software\\TortoiseGit\\ShowGitexeTimings", TRUE))
				err.Format(L"\r\n\r\n%s (%I64u ms @ %s)\r\n", (LPCTSTR)log, tickSpent, (LPCTSTR)strEndTime);
			else
				err.Format(L"\r\n\r\n%s\r\n", (LPCTSTR)log);
			if (!m_GitCmd.IsEmpty() || !m_GitCmdList.empty())
				InsertColorText(this->m_Log, err, RGB(255,0,0));
			if (CRegDWORD(L"Software\\TortoiseGit\\NoSounds", FALSE) == FALSE)
				PlaySound((LPCTSTR)SND_ALIAS_SYSTEMEXCLAMATION, nullptr, SND_ALIAS_ID | SND_ASYNC);
		}
		else {
			if (m_pTaskbarList)
				m_pTaskbarList->SetProgressState(m_hWnd, TBPF_NOPROGRESS);
			CString temp;
			temp.LoadString(IDS_SUCCESS);
			CString log;
			if (CRegDWORD(L"Software\\TortoiseGit\\ShowGitexeTimings", TRUE))
				log.Format(L"\r\n%s (%I64u ms @ %s)\r\n", (LPCTSTR)temp, tickSpent, (LPCTSTR)strEndTime);
			else
				log.Format(L"\r\n%s\r\n", (LPCTSTR)temp);
			InsertColorText(this->m_Log, log, RGB(0,0,255));
			this->DialogEnableWindow(IDCANCEL,FALSE);
		}

		m_Log.PostMessage(WM_VSCROLL, SB_BOTTOM, 0);
//.........这里部分代码省略.........
开发者ID:YueLinHo,项目名称:TortoiseGit,代码行数:101,代码来源:ProgressDlg.cpp


示例15: MHD_monotonic_sec_counter_init


//.........这里部分代码省略.........
#ifdef CLOCK_MONOTONIC
  /* Monotonic clock */
  /* Widely supported, may be affected by frequency adjustment */
  /* On Linux it's not truly monotonic as it doesn't count time in suspend */
  if (0 == clock_gettime (CLOCK_MONOTONIC,
                          &ts))
    {
      mono_clock_id = CLOCK_MONOTONIC;
      mono_clock_start = ts.tv_sec;
      mono_clock_source = _MHD_CLOCK_GETTIME;
    }
  else
#endif /* CLOCK_BOOTTIME */
#endif /* HAVE_CLOCK_GETTIME */
#ifdef HAVE_CLOCK_GET_TIME
  /* Darwin-specific monotonic clock */
  /* Should be monotonic as clock_set_time function always unconditionally */
  /* failed on latest kernels */
  if ( (KERN_SUCCESS == host_get_clock_service (mach_host_self(),
                                                SYSTEM_CLOCK,
                                                &mono_clock_service)) &&
       (KERN_SUCCESS == clock_get_time (mono_clock_service,
                                        &cur_time)) )
    {
      mono_clock_start = cur_time.tv_sec;
      mono_clock_source = _MHD_CLOCK_GET_TIME;
    }
  else
#endif /* HAVE_CLOCK_GET_TIME */
#ifdef _WIN32
#if _WIN32_WINNT >= 0x0600
  /* W32 Vista or later specific monotonic clock */
  /* Available since Vista, ~15ms accuracy */
  if (1)
    {
      tick_start = GetTickCount64 ();
      mono_clock_source = _MHD_CLOCK_GETTICKCOUNT64;
    }
  else
#else  /* _WIN32_WINNT < 0x0600 */
  /* W32 specific monotonic clock */
  /* Available on Windows 2000 and later */
  if (1)
    {
      LARGE_INTEGER freq;
      LARGE_INTEGER perf_counter;

      QueryPerformanceFrequency (&freq); /* never fail on XP and later */
      QueryPerformanceCounter (&perf_counter); /* never fail on XP and later */
      perf_freq = freq.QuadPart;
      perf_start = perf_counter.QuadPart;
      mono_clock_source = _MHD_CLOCK_PERFCOUNTER;
    }
  else
#endif /* _WIN32_WINNT < 0x0600 */
#endif /* _WIN32 */
#ifdef HAVE_CLOCK_GETTIME
#ifdef CLOCK_HIGHRES
  /* Solaris-specific monotonic high-resolution clock */
  /* Not preferred due to be potentially resource-hungry */
  if (0 == clock_gettime (CLOCK_HIGHRES,
                          &ts))
    {
      mono_clock_id = CLOCK_HIGHRES;
      mono_clock_start = ts.tv_sec;
      mono_clock_source = _MHD_CLOCK_GETTIME;
    }
  else
#endif /* CLOCK_HIGHRES */
#endif /* HAVE_CLOCK_GETTIME */
#ifdef HAVE_GETHRTIME
  /* HP-UX and Solaris monotonic clock */
  /* Not preferred due to be potentially resource-hungry */
  if (1)
    {
      hrtime_start = gethrtime ();
      mono_clock_source = _MHD_CLOCK_GETHRTIME;
    }
  else
#endif /* HAVE_GETHRTIME */
    {
      /* no suitable clock source was found */
      mono_clock_source = _MHD_CLOCK_NO_SOURCE;
    }

#ifdef HAVE_CLOCK_GET_TIME
  if ( (_MHD_CLOCK_GET_TIME != mono_clock_source) &&
       (_MHD_INVALID_CLOCK_SERV != mono_clock_service) )
    {
      /* clock service was initialised but clock_get_time failed */
      mach_port_deallocate (mach_task_self(),
                            mono_clock_service);
      mono_clock_service = _MHD_INVALID_CLOCK_SERV;
    }
#else
  (void) mono_clock_source; /* avoid compiler warning */
#endif /* HAVE_CLOCK_GET_TIME */

  sys_clock_start = time (NULL);
}
开发者ID:Karlson2k,项目名称:libmicrohttpd,代码行数:101,代码来源:mhd_mono_clock.c


示例16: _MCFCRT_GetFastMonoClock

uint64_t _MCFCRT_GetFastMonoClock(void){
	return GetTickCount64() + MONO_CLOCK_OFFSET * 3;
}
开发者ID:lhmouse,项目名称:MCF,代码行数:3,代码来源:clocks.c


示例17: dispatchEvents


//.........这里部分代码省略.........
				getMenu(menu, sizeof(menu));
				SimConnect_Text(hSimConnect, SIMCONNECT_TEXT_TYPE_MENU, 0, SELECTION, sizeof(menu), (void*)menu);
				break;

			case SIMCONNECT_TEXT_RESULT_MENU_SELECT_5:
				if (conf.maxetd > 5400)
				{
					conf.maxetd -= 3600;
				}
				getMenu(menu, sizeof(menu));
				SimConnect_Text(hSimConnect, SIMCONNECT_TEXT_TYPE_MENU, 0, SELECTION, sizeof(menu), (void*)menu);
				break;


			case SIMCONNECT_TEXT_RESULT_MENU_SELECT_6:
				if (conf.maxetd < 7*86400) // must be smaller than a week
				{
					conf.maxetd += 3600;
				}
				getMenu(menu, sizeof(menu));
				SimConnect_Text(hSimConnect, SIMCONNECT_TEXT_TYPE_MENU, 0, SELECTION, sizeof(menu), (void*)menu);
				break;

			case SIMCONNECT_TEXT_RESULT_MENU_SELECT_8:
				SimConnect_Text(hSimConnect, SIMCONNECT_TEXT_TYPE_MENU, 0, SELECTION, sizeof(empty), (void*)empty);
				break;
			default: //default cannot be close as displayed is also an event
				break;
			}
			saveConfig(conf);
			break;
		default:
			break;
		}
		break;
	}


	case SIMCONNECT_RECV_ID_SIMOBJECT_DATA_BYTYPE:
	{
		SIMCONNECT_RECV_SIMOBJECT_DATA_BYTYPE *pObjData = (SIMCONNECT_RECV_SIMOBJECT_DATA_BYTYPE*)pData;

		switch (pObjData->dwRequestID)
		{
		case R1:
		{
			DWORD ObjectID = pObjData->dwObjectID;
			DWORD entry = pObjData->dwentrynumber;
			DWORD outof = pObjData->dwoutof;
			DWORD length = pObjData->dwDefineCount;
			AIData *pS = (AIData*)&pObjData->dwData;
			if (ObjectID != SIMCONNECT_OBJECT_ID_USER)
			{
				if (strcmp(pS->state, "sleep") == 0 && pS->ETD > conf.maxetd)
				{
					if (FS10DeleteAIAircraft != NULL)
					{
						FS10DeleteAIAircraft(ObjectID, 1);
						++stats.nrOfDeletions;
						deletedSome = true;
					}
				}
			}

			if (entry == outof)
			{
				if (deletedSome)
				{
					stats.lastDeleted = GetTickCount64();
				}
				deletedSome = false;
			}


		}

		default:
			break;
		}
		break;
	}

	case SIMCONNECT_RECV_ID_EXCEPTION:
	{
		SIMCONNECT_RECV_EXCEPTION *except = (SIMCONNECT_RECV_EXCEPTION*)pData;
		printf("\n\n***** EXCEPTION=%d  SendID=%d  Index=%d  cbData=%d\n", except->dwException, except->dwSendID, except->dwIndex, cbData);
		break;
	}

	case SIMCONNECT_RECV_ID_QUIT:
	{
		quit = 1;
		break;
	}

	default:
		printf("\nReceived:%d", pData->dwID);
		break;
	}
}
开发者ID:DKlaper,项目名称:AIDeleter,代码行数:101,代码来源:SimCMain.cpp


示例18: port_wait

int port_wait(port_state_t* port_state,
              struct epoll_event* events,
              int maxevents,
              int timeout) {
  OVERLAPPED_ENTRY stack_iocp_events[PORT__MAX_ON_STACK_COMPLETIONS];
  OVERLAPPED_ENTRY* iocp_events;
  uint64_t due = 0;
  DWORD gqcs_timeout;
  int result;

  /* Check whether `maxevents` is in range. */
  if (maxevents <= 0)
    return_set_error(-1, ERROR_INVALID_PARAMETER);

  /* Decide whether the IOCP completion list can live on the stack, or allocate
   * memory for it on the heap. */
  if ((size_t) maxevents <= array_count(stack_iocp_events)) {
    iocp_events = stack_iocp_events;
  } else if ((iocp_events =
                  malloc((size_t) maxevents * sizeof *iocp_events)) == NULL) {
    iocp_events = stack_iocp_events;
    maxevents = array_count(stack_iocp_events);
  }

  /* Compute the timeout for GetQueuedCompletionStatus, and the wait end
   * time, if the user specified a timeout other than zero or infinite. */
  if (timeout > 0) {
    due = GetTickCount64() + (uint64_t) timeout;
    gqcs_timeout = (DWORD) timeout;
  } else if (timeout == 0) {
    gqcs_timeout = 0;
  } else {
    gqcs_timeout = INFINITE;
  }

  EnterCriticalSection(&port_state->lock);

  /* Dequeue completion packets until either at least one interesting event
   * has been discovered, or the timeout is reached. */
  for (;;) {
    uint64_t now;

    result = port__poll(
        port_state, events, iocp_events, (DWORD) maxevents, gqcs_timeout);
    if (result < 0 || result > 0)
      break; /* Result, error, or time-out. */

    if (timeout < 0)
      continue; /* When timeout is negative, never time out. */

    /* Update time. */
    now = GetTickCount64();

    /* Do not allow the due time to be in the past. */
    if (now >= due) {
      SetLastError(WAIT_TIMEOUT);
      break;
    }

    /* Recompute time-out argument for GetQueuedCompletionStatus. */
    gqcs_timeout = (DWORD)(due - now);
  }

  port__update_events_if_polling(port_state);

  LeaveCriticalSection(&port_state->lock);

  if (iocp_events != stack_iocp_events)
    free(iocp_events);

  if (result >= 0)
    return result;
  else if (GetLastError() == WAIT_TIMEOUT)
    return 0;
  else
    return -1;
}
开发者ID:piscisaureus,项目名称:epoll_windows,代码行数:77,代码来源:port.c


示例19: pymonotonic

static int
pymonotonic(_PyTime_t *tp, _Py_clock_info_t *info, int raise)
{
#if defined(MS_WINDOWS)
    ULONGLONG ticks;
    _PyTime_t t;

    assert(info == NULL || raise);

    ticks = GetTickCount64();
    Py_BUILD_ASSERT(sizeof(ticks) <= sizeof(_PyTime_t));
    t = (_PyTime_t)ticks;

    if (_PyTime_check_mul_overflow(t, MS_TO_NS)) {
        if (raise) {
            _PyTime_overflow();
            return -1;
        }
        /* Hello, time traveler! */
        assert(0);
    }
    *tp = t * MS_TO_NS;

    if (info) {
        DWORD timeAdjustment, timeIncrement;
        BOOL isTimeAdjustmentDisabled, ok;
        info->implementation = "GetTickCount64()";
        info->monotonic = 1;
        ok = GetSystemTimeAdjustment(&timeAdjustment, &timeIncrement,
                                     &isTimeAdjustmentDisabled);
        if (!ok) {
            PyErr_SetFromWindowsErr(0);
            return -1;
        }
        info->resolution = timeIncrement * 1e-7;
        info->adjustable = 0;
    }

#elif defined(__APPLE__)
    static mach_timebase_info_data_t timebase;
    uint64_t time;

    if (timebase.denom == 0) {
        /* According to the Technical Q&A QA1398, mach_timebase_info() cannot
           fail: https://developer.apple.com/library/mac/#qa/qa1398/ */
        (void)mach_timebase_info(&timebase);
    }

    time = mach_absolute_time();

    /* apply timebase factor */
    time *= timebase.numer;
    time /= timebase.denom;

    *tp = time;

    if (info) {
        info->implementation = "mach_absolute_time()";
        info->resolution = (double)timebase.numer / timebase.denom * 1e-9;
        info->monotonic = 1;
        info->adjustable = 0;
    }

#else
    struct timespec ts;
#ifdef CLOCK_HIGHRES
    const clockid_t clk_id = CLOCK_HIGHRES;
    const char *implementation = "clock_gettime(CLOCK_HIGHRES)";
#else
    const clockid_t clk_id = CLOCK_MONOTONIC;
    const char *implementation = "clock_gettime(CLOCK_MONOTONIC)";
#endif

    assert(info == NULL || raise);

    if (clock_gettime(clk_id, &ts) != 0) {
        if (raise) {
            PyErr_SetFromErrno(PyExc_OSError);
            return -1;
        }
        return -1;
    }

    if (info) {
        struct timespec res;
        info->monotonic = 1;
        info->implementation = implementation;
        info->adjustable = 0;
        if (clock_getres(clk_id, &res) != 0) {
            PyErr_SetFromErrno(PyExc_OSError);
            return -1;
        }
        info->resolution = res.tv_sec + res.tv_nsec * 1e-9;
    }
    if (_PyTime_FromTimespec(tp, &ts, raise) < 0)
        return -1;
#endif
    return 0;
}
开发者ID:3lnc,项目名称:cpython,代码行数:99,代码来源:pytime.c


示例20: systemGetClock

u32 systemGetClock()
{
	if ( GetTickCount64() > 4294967296 )
		return 0;
	return (u32)GetTickCount64();
}
开发者ID:metalnow,项目名称:VBAWp8,代码行数:6,代码来源:VBASys.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetTicks函数代码示例发布时间:2022-05-30
下一篇:
C++ GetTickCount函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap