summaryrefslogtreecommitdiffstats
path: root/base/time_win.cc
Commit message (Collapse)AuthorAgeFilesLines
* Fixing Time::Max()'s behavior with Time::ToTimeT() and friends.mkwst@chromium.org2012-09-081-0/+13
| | | | | | | | | | | | | | It looks like the math that's done to convert epoch times between platforms is giving incorrect results when confronted with a "max" time. This CL adjusts the various conversion methods to persist maxness in the same way they currently persist zeroness. BUG=146328 Review URL: https://chromiumcodereview.appspot.com/10916089 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155591 0039d316-1c4b-4281-b951-d872f2087c98
* Add native QPC to base::Time* conversion on Windows.brianderson@chromium.org2012-08-031-9/+34
| | | | | | | | BUG=137792 Review URL: https://chromiumcodereview.appspot.com/10843038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149801 0039d316-1c4b-4281-b951-d872f2087c98
* Add interface to system trace clock.sleffler@chromium.org2012-05-011-1/+6
| | | | | | | | | | | | | | | | | | Add TimeTicks::NowFromSystemTraceTime to return the current system trace event clock (falling back to TimeTicks::HighResNow when not supported). On systems where the system trace clock is available this allows system and chrome events to be stamped with a common clock (eliminating post-processing time shift adjustment that can be hard). BUG=chromium-os:27809 TEST=unit tests + collect trace data on chrome os w/ kernel that supports clock_gettime(CLOCK_SYSTEM_TRACE) Change-Id: Ia6a500bd13a6f09c49052a1dd1421027960d8dea Review URL: http://codereview.chromium.org/10257020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134772 0039d316-1c4b-4281-b951-d872f2087c98
* Relanding precompiled header support for VS 2008, now enabled forjoi@chromium.org2011-09-201-1/+6
| | | | | | | | | | | | | | | | | Debug builds only as official builds were failing with out of memory errors. This is mostly a revert of http://crrev.com/101836 which was a revert of the original change, http://crrev.com/101474, except for a modification to build/win_precompile.gypi to only enable use of precompiled headers in the Debug configuration. BUG=none TEST=it builds Review URL: http://codereview.chromium.org/7977003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102029 0039d316-1c4b-4281-b951-d872f2087c98
* Temporary revert of r101474, will re-land tomorrow with a change to disable ↵joi@chromium.org2011-09-191-6/+1
| | | | | | | | | | | | | | | | | | | | use of precompiled headers in Release builds as our Canary builds are failing with out of memory messages. Original change description: Switch on use of precompiled headers for VS 2008. The precompiled header brings in more definitions of abs() for the base/time_win.cc file, and a hint to the compiler was needed to let VS 2008 build the file correctly. On VS 2008 only, the mini_installer target did not link correctly with precompiled headers enabled so this change disables them for that project. BUG=none TEST=it builds (esp. on Windows), existing tests pass Review URL: http://codereview.chromium.org/7910002 TBR=laforge@chromium.org Review URL: http://codereview.chromium.org/7945017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101836 0039d316-1c4b-4281-b951-d872f2087c98
* Switch on use of precompiled headers for VS 2008.joi@chromium.org2011-09-161-1/+6
| | | | | | | | | | | | | The precompiled header brings in more definitions of abs() for the base/time_win.cc file, and a hint to the compiler was needed to let VS 2008 build the file correctly. On VS 2008 only, the mini_installer target did not link correctly with precompiled headers enabled so this change disables them for that project. BUG=none TEST=it builds (esp. on Windows), existing tests pass Review URL: http://codereview.chromium.org/7910002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101474 0039d316-1c4b-4281-b951-d872f2087c98
* Fix Time::Explode on Windows and PepperMessageFilter::OnGetLocalTimeZoneOffset.yzshen@chromium.org2011-07-061-18/+32
| | | | | | | | | BUG=None TEST=All time unittests pass. Review URL: http://codereview.chromium.org/7282018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91602 0039d316-1c4b-4281-b951-d872f2087c98
* Fix a possible crash on windows.thakis@chromium.org2011-05-211-1/+1
| | | | | | | | | | | Also see http://codereview.chromium.org/7057021 BUG=83236 TEST=none Review URL: http://codereview.chromium.org/7055013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86227 0039d316-1c4b-4281-b951-d872f2087c98
* Reland old fix that was reverted incorrectly.mbelshe@chromium.org2011-05-151-4/+19
| | | | | | | | | | | | | | | Fix regression where high resolution timers could be activated even under battery power. Add unit test to protect chromium from developers like me in the future. The fix is a one-liner in hi_res_timer_manager_win.cc. The rest of the code change is the mechanics to enable the unit test. BUG=59528 TEST=HiResTimerManagerTest.ToggleOnOff Review URL: http://codereview.chromium.org/6904117 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85413 0039d316-1c4b-4281-b951-d872f2087c98
* Update DCHECK() usage to utilize the more expressive debugging functions.kushi.p@gmail.com2011-04-221-1/+1
| | | | | | | | BUG=58409 Review URL: http://codereview.chromium.org/6891008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82639 0039d316-1c4b-4281-b951-d872f2087c98
* Move some files from base to base/memory.levin@chromium.org2011-03-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | raw_scoped_refptr_mismatch_checker.h ref_counted.cc ref_counted.h ref_counted_memory.cc ref_counted_memory.h ref_counted_unittest.cc scoped_callback_factory.h scoped_comptr_win.h scoped_handle.h scoped_native_library.cc scoped_native_library.h scoped_native_library_unittest.cc scoped_nsobject.h scoped_open_process.h scoped_ptr.h scoped_ptr_unittest.cc scoped_temp_dir.cc scoped_temp_dir.h scoped_temp_dir_unittest.cc scoped_vector.h singleton.h singleton_objc.h singleton_unittest.cc linked_ptr.h linked_ptr_unittest.cc weak_ptr.cc weak_ptr.h weak_ptr_unittest.cc BUG=None TEST=Compile Review URL: http://codereview.chromium.org/6714032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79524 0039d316-1c4b-4281-b951-d872f2087c98
* Remove obsolete base/lock.h and fix up callers to use the new header file andbrettw@chromium.org2011-01-211-4/+4
| | | | | | | | | | | the base namespace. Fix several files including lock.h unnecessarily. BUG=none TEST=none Original review=http://codereview.chromium.org/6142009/ Patch by leviw@chromium.org git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72106 0039d316-1c4b-4281-b951-d872f2087c98
* This CL add a GetInstance() method to singleton classes instead of relying ↵satish@chromium.org2010-12-041-14/+18
| | | | | | | | | | | | | | | | | on the callers to use Singleton<T>. In some cases I have used the LazyInstance<T> pattern as that was simpler. This is a small step towards making all singleton classes use the Singleton<T> pattern within their code and not expect the callers to know about it. I have selected all files under src/app and src/base which use Singleton<T> in this CL. Once this CL goes in I'll work on the rest of the files. BUG=65298 TEST=all existing tests should continue to pass. Review URL: http://codereview.chromium.org/5527004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68300 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 63191 - 2nd try:phajdan.jr@chromium.org2010-10-201-19/+4
| | | | | | | | | | | | | | | | | | | | | | | | Fix regression where high resolution timers could be activated even under battery power. Add unit test to protect chromium from developers like me in the future. The fix is a one-liner in hi_res_timer_manager_win.cc. The rest of the code change is the mechanics to enable the unit test. BUG=59528 TEST=HiResTimerManagerTest.ToggleOnOff Broke unit_tests on Vista and XP: [ RUN ] GeolocationNetworkProviderTest.GatewayAndWifiScans [2916:2376:1020/030222:2975321329:FATAL:network_location_provider.cc(51)] Check failed: cache_.size() == cache_times_.size(). Review URL: http://codereview.chromium.org/3889004 TBR=mbelshe@chromium.org Review URL: http://codereview.chromium.org/3946003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63200 0039d316-1c4b-4281-b951-d872f2087c98
* 2nd try:mbelshe@chromium.org2010-10-201-4/+19
| | | | | | | | | | | | | | | | Fix regression where high resolution timers could be activated even under battery power. Add unit test to protect chromium from developers like me in the future. The fix is a one-liner in hi_res_timer_manager_win.cc. The rest of the code change is the mechanics to enable the unit test. BUG=59528 TEST=HiResTimerManagerTest.ToggleOnOff Review URL: http://codereview.chromium.org/3889004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63191 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 63176 - Fix regression where high resolution timers could be ↵mbelshe@chromium.org2010-10-201-19/+4
| | | | | | | | | | | | | | | | | | | | activated even under battery power. Add unit test to protect chromium from developers like me in the future. The fix is a one-liner in hi_res_timer_manager_win.cc. The rest of the code change is the mechanics to enable the unit test. BUG=59528 TEST=HiResTimerManagerTest.ToggleOnOff Review URL: http://codereview.chromium.org/3848002 TBR=mbelshe@chromium.org Review URL: http://codereview.chromium.org/3948001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63177 0039d316-1c4b-4281-b951-d872f2087c98
* Fix regression where high resolution timers could be activated even undermbelshe@chromium.org2010-10-201-4/+19
| | | | | | | | | | | | | | | battery power. Add unit test to protect chromium from developers like me in the future. The fix is a one-liner in hi_res_timer_manager_win.cc. The rest of the code change is the mechanics to enable the unit test. BUG=59528 TEST=HiResTimerManagerTest.ToggleOnOff Review URL: http://codereview.chromium.org/3848002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63176 0039d316-1c4b-4281-b951-d872f2087c98
* The submillisecond test was broken in at least two ways. First, thembelshe@chromium.org2010-09-231-0/+5
| | | | | | | | | | | | | | | | | high resolution clock is intentionally disabled on some systems (old AMDs). If QueryPerformanceCounter doesn't work on this system, we shouldn't run the test. Second, however, if the time between two HighResNow() calls is *always* 0us, then this test would fail. Due to speedstep technology with intentionally underclocked QPC (at the windows level), this is quite possible. BUG=42850 TEST=TimeTicks.SubMillisecondTimers Review URL: http://codereview.chromium.org/3387011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60293 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 59007 - Adding some utility functions that work on file handles, and ↵dumi@chromium.org2010-09-091-5/+0
| | | | | | | | | | | | | | | | | adding the corresponding relays to file_util_proxy. BUG=none TEST=none Review URL: http://codereview.chromium.org/3303007 TBR=dumi@chromium.org Review URL: http://codereview.chromium.org/3371011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59013 0039d316-1c4b-4281-b951-d872f2087c98
* Adding some utility functions that work on file handles, and addingdumi@chromium.org2010-09-091-0/+5
| | | | | | | | | | | | the corresponding relays to file_util_proxy. BUG=none TEST=none Review URL: http://codereview.chromium.org/3303007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59007 0039d316-1c4b-4281-b951-d872f2087c98
* GTTF: Avoid assertion failures caused by clock drift.phajdan.jr@chromium.org2010-08-041-11/+14
| | | | | | | | | | | | | | | Instead, we add a test dedicated to verifying the QPC time drift. Otherwise the assertion is being flakily hit in unrelated tests, which crashes the entire test binary. With a dedicated test, we still have necessary monitoring, but it's in one place. TEST=base_unittests, net_unittests (stop crashing) BUG=none Review URL: http://codereview.chromium.org/3082014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54978 0039d316-1c4b-4281-b951-d872f2087c98
* GTTF: Increase the limit for QPC drift.phajdan.jr@chromium.org2010-07-291-2/+2
| | | | | | | | | | | | | Also update the DCHECK to use an absolute value of the skew for comparison. It could be negative. TEST=base_unittests BUG=none Review URL: http://codereview.chromium.org/3083002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54191 0039d316-1c4b-4281-b951-d872f2087c98
* Change a DCHECK to a DCHECK_LT so we can see the failing values.evan@chromium.org2010-07-281-1/+1
| | | | | | | | | | | This DCHECK sometimes fails on the bots; seeing the failing values may help us diagnose the problem. BUG=50556 Review URL: http://codereview.chromium.org/3068010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54069 0039d316-1c4b-4281-b951-d872f2087c98
* Change chrome from statically enabling high resolution timers on windowsmbelshe@chromium.org2010-06-291-9/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | to enabling them dynamically - only when the application really needs them. I am working on some test cases for this, and will add them. But wanted to send out the concept for review. In this implementation, I modify the message loop to detect when the application has requested high resolution timers. Note that there are multiple MessageLoops active in a single process. After a period of time, we simply shut it off again. We could have set a timer or kept a count of active timers, or any number of more complex algorithms. But I think this algorithm is very simple and good enough. If an application continues needing high resolution timers for more than 1s, we'll turn the high-resolution timers back on again. One last change - since we've implemented the clamp at 4ms, there isn't a lot of point to our use of 1ms for timeBeginPeriod. I've modified that to 2 (which is half of 4ms, our target minimal interval). BUG=46531 TEST=MessageLoop.HighResolutionTimers Review URL: http://codereview.chromium.org/2822035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51102 0039d316-1c4b-4281-b951-d872f2087c98
* Remove the NowSingleton from time_win.cc.phajdan.jr@chromium.org2010-05-111-34/+29
| | | | | | | | | | | | | | Convert it to a set of static variables. This should help avoiding problems with very low-level Singletons. TEST=base_unittests and others BUG=none Review URL: http://codereview.chromium.org/1990005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46907 0039d316-1c4b-4281-b951-d872f2087c98
* Style cleanup in preparation for auto-linting base/.erg@google.com2010-01-261-1/+1
| | | | | | | | | BUG=none TEST=none Review URL: http://codereview.chromium.org/552004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37164 0039d316-1c4b-4281-b951-d872f2087c98
* Make SystemMonitor not a Singleton and move it out of basephajdan.jr@chromium.org2009-11-261-67/+12
| | | | | | | | | | | | | SystemMonitor makes an assumption that through its lifetime a MessageLoop exists and stays the same. It is difficult and error-prone to satisfy that when it is a Singleton. It has caused problems in the past. Additionally, extract HighResoltionTimerManager out of time_win.cc, eliminating yet another Singleton. TEST=none BUG=none Review URL: http://codereview.chromium.org/431008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33214 0039d316-1c4b-4281-b951-d872f2087c98
* Simplify the PowerObserver API by removing unneeded args and providing ↵pkasting@chromium.org2009-10-011-13/+9
| | | | | | | | | | | | default implementations. This also makes all the subclasses use the same code to add/remove observers. BUG=none TEST=none Review URL: http://codereview.chromium.org/244054 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27740 0039d316-1c4b-4281-b951-d872f2087c98
* Make int64 -> Time conversion explicit.phajdan.jr@chromium.org2009-09-141-1/+1
| | | | | | | | | | | Landing Patch for Jacob Mandelson, original review: http://codereview.chromium.org/200093 BUG=none TEST=base_unittests & app_unittests Review URL: http://codereview.chromium.org/205003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26134 0039d316-1c4b-4281-b951-d872f2087c98
* Do not monitor system power state during unit tests.phajdan.jr@chromium.org2009-05-271-30/+75
| | | | | | | | | | | | | The observer requires that message loop stays up and same through its lifetime. This is not true during testing. TEST=none http://crbug.com/12187 Review URL: http://codereview.chromium.org/113824 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16976 0039d316-1c4b-4281-b951-d872f2087c98
* Retrial of the first step to port file_util::CountFilesCreatedAfter()erikkay@google.com2009-04-181-1/+8
| | | | | | | | | Submitting http://codereview.chromium.org/75033 on behalf of hamaji Review URL: http://codereview.chromium.org/67276 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13993 0039d316-1c4b-4281-b951-d872f2087c98
* NO CODE CHANGE (except one global std::wstring changed to const wchar_t* ↵maruel@chromium.org2009-03-031-5/+5
| | | | | | | | | | | const per style compliance). Preliminary work to enforce new PRESUBMIT.py rules: - <=80 cols - no trailing whitespaces - svn:eol-style=LF git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10791 0039d316-1c4b-4281-b951-d872f2087c98
* Make the SystemMonitor observer list thread safe.mbelshe@google.com2008-11-031-1/+3
| | | | | | | | This is done by using the new observer_list_threadsafe. Review URL: http://codereview.chromium.org/4288 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4452 0039d316-1c4b-4281-b951-d872f2087c98
* Move Time, TimeDelta and TimeTicks into namespace base.dsh@google.com2008-10-271-0/+4
| | | | | | Review URL: http://codereview.chromium.org/7995 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4022 0039d316-1c4b-4281-b951-d872f2087c98
* Change to Hi Res timers on Windows.mbelshe@google.com2008-09-261-31/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are two parts of this: 1) TimeTicks:Now() Don't call timeBeginPeriod() in all cases. Use the new SystemMonitor class to watch battery on/off transitions and use the timeBeginPeriod() only when we're using the battery. 2) TimeTicks::UnreliableHiResNow() Change this function from "UnreliableHiResNow()" to "HiResNow()". We still use QPC, but we detect if we're on AMD Athlon XP machines which fail on QPC. For those systems, we fall back to TimeTicks::Now(). Updated tests to detect hardware specifics of timers. Output of the test will contain lines such as these: [ RUN ] TimeTicks.SubMillisecondTimers Min timer is: 1us [ OK ] TimeTicks.SubMillisecondTimers [ RUN ] TimeTicks.TimeGetTimeCaps timeGetTime range is 1 to 1000000ms [ OK ] TimeTicks.TimeGetTimeCaps [ RUN ] TimeTicks.QueryPerformanceFrequency QueryPerformanceFrequency is 2394.18MHz [ OK ] TimeTicks.QueryPerformanceFrequency [ RUN ] TimeTicks.TimerPerformance Time::Now: 0.11us per call TimeTicks::Now: 0.09us per call TimeTicks::HighResNow: 0.26us per call [ OK ] TimeTicks.TimerPerformance Review URL: http://codereview.chromium.org/4092 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2625 0039d316-1c4b-4281-b951-d872f2087c98
* Don't use the Windows high-resolution Time::Now hacks on Posix, the normal ↵deanm@chromium.org2008-09-111-4/+45
| | | | | | | | resultion from the time APIs there should be enough. Review URL: http://codereview.chromium.org/2420 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2056 0039d316-1c4b-4281-b951-d872f2087c98
* Reapply r1633 (which was reverted by r1635), with some additional ↵deanm@google.com2008-09-091-54/+94
| | | | | | | | modifications. Consolidate all timer resolution code to time.h, and always depend on TimeTicks::Now for 1ms resolution. Review URL: http://codereview.chromium.org/1806 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1893 0039d316-1c4b-4281-b951-d872f2087c98
* Revert part of r1633 Windows time changes, seems to have caused test failures?deanm@google.com2008-09-021-70/+55
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1635 0039d316-1c4b-4281-b951-d872f2087c98
* Cleanup some Windows TimeTicks functions. Move TickTicks::Now and ↵deanm@google.com2008-09-021-55/+70
| | | | | | | | TicksTicks::UnreliableHighResNow to Singletons, which cleans up the code and removes some possible unsafe cross-thread access. Move the Windows-specific rollover tests to time_unittests_win. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1633 0039d316-1c4b-4281-b951-d872f2087c98
* Use a more compact license header in source files.license.bot2008-08-241-28/+4
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1287 0039d316-1c4b-4281-b951-d872f2087c98
* Add base to the repository.initial.commit2008-07-261-0/+244
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8 0039d316-1c4b-4281-b951-d872f2087c98