Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/process_info.h" | |
| 6 | |
| 7 #include <windows.h> | |
| 8 | |
| 9 #include "base/basictypes.h" | |
| 10 #include "base/time.h" | |
| 11 | |
| 12 namespace { | |
| 13 | |
| 14 using base::Time; | |
| 15 | |
| 16 // Returns the process creation time, or a null time object if an error | |
| 17 // occurred. | |
| 18 Time ProcessCreationTimeInternal() { | |
| 19 FILETIME creation_time = {}; | |
| 20 FILETIME ignore = {}; | |
| 21 if (::GetProcessTimes(::GetCurrentProcess(), &creation_time, &ignore, | |
| 22 &ignore, &ignore) == false) | |
| 23 return Time(); | |
| 24 | |
| 25 return Time::FromFileTime(creation_time); | |
| 26 } | |
| 27 | |
| 28 } // namespace | |
| 29 | |
| 30 namespace base { | |
| 31 | |
| 32 //static | |
| 33 const Time* CurrentProcessInfo::CreationTime() { | |
| 34 static Time process_creation_time = ProcessCreationTimeInternal(); | |
|
Mark Mentovai
2012/06/19 16:08:00
As in the Mac file.
| |
| 35 return &process_creation_time; | |
| 36 } | |
| 37 | |
| 38 } // namespace base | |
| OLD | NEW |