CefTime CaffeineClientApp::getRenderProcessCreationTime() { // Get process start time for the render process FILETIME cpuTime, sysTime, creationTime, exitTime; CefTime processTime; if (GetProcessTimes(GetCurrentProcess(), &creationTime, &exitTime, &sysTime, &cpuTime)) { ULONGLONG ull = reinterpret_cast<const ULONGLONG&>(creationTime); ull -= 116444736000000000; ull /= 10000000; processTime.SetTimeT(static_cast<time_t>(ull)); } return processTime; }
// // FUNCTION: InitMainWindowInstance(HINSTANCE, int) // // PURPOSE: Saves instance handle and creates main window // // COMMENTS: // // In this function, we save the instance handle in a global variable and // create and display the main program window. // HWND InitMainWindowInstance( HINSTANCE hInstance, int nCmdShow, PTCHAR szWindowClass, PTCHAR szTitle) { hInst = hInstance; // Store instance handle in our global variable beginMainWindowCreationTime.Now(); // Should make window size be data driven mainWindowHandle = CreateWindowEx(WS_EX_OVERLAPPEDWINDOW | WS_EX_CLIENTEDGE, szWindowClass, szTitle, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, CW_USEDEFAULT, CW_USEDEFAULT, // WS_POPUP, CW_USEDEFAULT, 0, DEFAULT_WIN_WIDTH, DEFAULT_WIN_HEIGHT, NULL, NULL, hInstance, NULL); if (mainWindowHandle) { if (!devMode) { jumpList.SetUpJumpList(hInst); } } return mainWindowHandle; }
jobject NewJNIDate(JNIEnv* env, const CefTime& time) { jobject jdate = NewJNIObject(env, "java/util/Date"); if (!jdate) return NULL; double timestamp = time.GetDoubleT() * 1000; JNI_CALL_VOID_METHOD(env, jdate, "setTime", "(J)V",(jlong)timestamp); return jdate; }
void SetCefTime(const CefTime &value, CefRefPtr<TList> list, TIndex index) { auto doubleT = value.GetDoubleT(); unsigned char mem[1 + sizeof(double)]; mem[0] = static_cast<unsigned char>(PrimitiveType::CEFTIME); memcpy(reinterpret_cast<void*>(mem + 1), &doubleT, sizeof(double)); auto binaryValue = CefBinaryValue::Create(mem, sizeof(mem)); list->SetBinary(index, binaryValue); }
static Upp::String GetCefTimeString(const CefTime& v) { if (v.GetTimeT() == 0) return "Unspecified"; Upp::Time t; t.year = v.year; t.month = v.month; t.day = v.day_of_month; t.hour = v.hour; t.minute= v.minute; t.second= v.second; return Upp::FormatTime(t, "YYYY-MM-DD hh:mm:ss"); }