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 // Return the process creation time. | |
| 17 Time ProcessCreationTimeInternal() { | |
| 18 // Calculate the time that has elapsed from our own process creation. | |
| 19 FILETIME creation_time = {}; | |
| 20 FILETIME ignore = {}; | |
| 21 ::GetProcessTimes(::GetCurrentProcess(), &creation_time, &ignore, &ignore, | |
| 22 &ignore); | |
|
jeremy
2012/06/19 15:44:20
Looks like this function can fail too, so I need t
| |
| 23 | |
| 24 return base::Time::FromFileTime(creation_time); | |
| 25 } | |
| 26 | |
| 27 } // namespace | |
| 28 | |
| 29 namespace base { | |
| 30 | |
| 31 //static | |
| 32 const Time* CurrentProcessInfo::CreationTime() { | |
| 33 static Time process_creation_time = | |
| 34 ProcessCreationTimeInternal(); | |
| 35 return &process_creation_time; | |
| 36 } | |
| 37 | |
| 38 } // namespace base | |
| OLD | NEW |