Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Side by Side Diff: src/shared/platform/win/time_win.cc

Issue 7057021: Fix a possible crash on windows. (Closed) Base URL: http://src.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 7
8 // Make sure that winmm.lib is added to the linker's input. 8 // Make sure that winmm.lib is added to the linker's input.
9 #pragma comment(lib, "winmm.lib") 9 #pragma comment(lib, "winmm.lib")
10 #include "native_client/src/include/portability.h" 10 #include "native_client/src/include/portability.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 FILETIME ft; 106 FILETIME ft;
107 if (is_local) 107 if (is_local)
108 success = FileTimeToLocalFileTime(&utc_ft, &ft); 108 success = FileTimeToLocalFileTime(&utc_ft, &ft);
109 else 109 else
110 ft = utc_ft; 110 ft = utc_ft;
111 111
112 // FILETIME in SYSTEMTIME (exploded). 112 // FILETIME in SYSTEMTIME (exploded).
113 SYSTEMTIME st; 113 SYSTEMTIME st;
114 if (!success || !FileTimeToSystemTime(&ft, &st)) { 114 if (!success || !FileTimeToSystemTime(&ft, &st)) {
115 // NOTREACHED() << "Unable to convert time, don't know why"; 115 // NOTREACHED() << "Unable to convert time, don't know why";
116 ZeroMemory(exploded, sizeof(exploded)); 116 ZeroMemory(exploded, sizeof(*exploded));
117 return; 117 return;
118 } 118 }
119 119
120 exploded->year = st.wYear; 120 exploded->year = st.wYear;
121 exploded->month = st.wMonth; 121 exploded->month = st.wMonth;
122 exploded->day_of_week = st.wDayOfWeek; 122 exploded->day_of_week = st.wDayOfWeek;
123 exploded->day_of_month = st.wDay; 123 exploded->day_of_month = st.wDay;
124 exploded->hour = st.wHour; 124 exploded->hour = st.wHour;
125 exploded->minute = st.wMinute; 125 exploded->minute = st.wMinute;
126 exploded->second = st.wSecond; 126 exploded->second = st.wSecond;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 if (!QueryPerformanceFrequency(&ticks_per_sec)) 215 if (!QueryPerformanceFrequency(&ticks_per_sec))
216 return TimeTicks(0); // Broken, we don't guarantee this function works. 216 return TimeTicks(0); // Broken, we don't guarantee this function works.
217 ticks_per_microsecond = 217 ticks_per_microsecond =
218 ticks_per_sec.QuadPart / Time::kMicrosecondsPerSecond; 218 ticks_per_sec.QuadPart / Time::kMicrosecondsPerSecond;
219 } 219 }
220 220
221 LARGE_INTEGER now; 221 LARGE_INTEGER now;
222 QueryPerformanceCounter(&now); 222 QueryPerformanceCounter(&now);
223 return TimeTicks(now.QuadPart / ticks_per_microsecond); 223 return TimeTicks(now.QuadPart / ticks_per_microsecond);
224 } 224 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698