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

Side by Side Diff: base/time/time_win.cc

Issue 596103002: Fix more disabled MSVC warnings, base/ edition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comment Created 6 years, 2 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 | « base/time/time.h ('k') | base/time/time_win_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 5
6 // Windows Timer Primer 6 // Windows Timer Primer
7 // 7 //
8 // A good article: http://www.ddj.com/windows/184416651 8 // A good article: http://www.ddj.com/windows/184416651
9 // A good mozilla bug: http://bugzilla.mozilla.org/show_bug.cgi?id=363258 9 // A good mozilla bug: http://bugzilla.mozilla.org/show_bug.cgi?id=363258
10 // 10 //
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 bool Time::IsHighResolutionTimerInUse() { 220 bool Time::IsHighResolutionTimerInUse() {
221 base::AutoLock lock(g_high_res_lock.Get()); 221 base::AutoLock lock(g_high_res_lock.Get());
222 return g_high_res_timer_enabled && g_high_res_timer_count > 0; 222 return g_high_res_timer_enabled && g_high_res_timer_count > 0;
223 } 223 }
224 224
225 // static 225 // static
226 Time Time::FromExploded(bool is_local, const Exploded& exploded) { 226 Time Time::FromExploded(bool is_local, const Exploded& exploded) {
227 // Create the system struct representing our exploded time. It will either be 227 // Create the system struct representing our exploded time. It will either be
228 // in local time or UTC. 228 // in local time or UTC.
229 SYSTEMTIME st; 229 SYSTEMTIME st;
230 st.wYear = exploded.year; 230 st.wYear = static_cast<WORD>(exploded.year);
231 st.wMonth = exploded.month; 231 st.wMonth = static_cast<WORD>(exploded.month);
232 st.wDayOfWeek = exploded.day_of_week; 232 st.wDayOfWeek = static_cast<WORD>(exploded.day_of_week);
233 st.wDay = exploded.day_of_month; 233 st.wDay = static_cast<WORD>(exploded.day_of_month);
234 st.wHour = exploded.hour; 234 st.wHour = static_cast<WORD>(exploded.hour);
235 st.wMinute = exploded.minute; 235 st.wMinute = static_cast<WORD>(exploded.minute);
236 st.wSecond = exploded.second; 236 st.wSecond = static_cast<WORD>(exploded.second);
237 st.wMilliseconds = exploded.millisecond; 237 st.wMilliseconds = static_cast<WORD>(exploded.millisecond);
238 238
239 FILETIME ft; 239 FILETIME ft;
240 bool success = true; 240 bool success = true;
241 // Ensure that it's in UTC. 241 // Ensure that it's in UTC.
242 if (is_local) { 242 if (is_local) {
243 SYSTEMTIME utc_st; 243 SYSTEMTIME utc_st;
244 success = TzSpecificLocalTimeToSystemTime(NULL, &st, &utc_st) && 244 success = TzSpecificLocalTimeToSystemTime(NULL, &st, &utc_st) &&
245 SystemTimeToFileTime(&utc_st, &ft); 245 SystemTimeToFileTime(&utc_st, &ft);
246 } else { 246 } else {
247 success = !!SystemTimeToFileTime(&st, &ft); 247 success = !!SystemTimeToFileTime(&st, &ft);
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 return TimeTicks() + TimeDelta::FromMilliseconds(timeGetTime()); 547 return TimeTicks() + TimeDelta::FromMilliseconds(timeGetTime());
548 } 548 }
549 } 549 }
550 550
551 // TimeDelta ------------------------------------------------------------------ 551 // TimeDelta ------------------------------------------------------------------
552 552
553 // static 553 // static
554 TimeDelta TimeDelta::FromQPCValue(LONGLONG qpc_value) { 554 TimeDelta TimeDelta::FromQPCValue(LONGLONG qpc_value) {
555 return TimeDelta(GetHighResNowSingleton()->QPCValueToMicroseconds(qpc_value)); 555 return TimeDelta(GetHighResNowSingleton()->QPCValueToMicroseconds(qpc_value));
556 } 556 }
OLDNEW
« no previous file with comments | « base/time/time.h ('k') | base/time/time_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698