Chromium Code Reviews| Index: base/process_info_win.cc |
| diff --git a/base/process_info_win.cc b/base/process_info_win.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..48f2ccfb9ce163f58a745e5266cfb9f2d39aaee9 |
| --- /dev/null |
| +++ b/base/process_info_win.cc |
| @@ -0,0 +1,38 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "base/process_info.h" |
| + |
| +#include <windows.h> |
| + |
| +#include "base/basictypes.h" |
| +#include "base/time.h" |
| + |
| +namespace { |
| + |
| +using base::Time; |
| + |
| +// Return the process creation time. |
| +Time ProcessCreationTimeInternal() { |
| + // Calculate the time that has elapsed from our own process creation. |
| + FILETIME creation_time = {}; |
| + FILETIME ignore = {}; |
| + ::GetProcessTimes(::GetCurrentProcess(), &creation_time, &ignore, &ignore, |
| + &ignore); |
|
jeremy
2012/06/19 15:44:20
Looks like this function can fail too, so I need t
|
| + |
| + return base::Time::FromFileTime(creation_time); |
| +} |
| + |
| +} // namespace |
| + |
| +namespace base { |
| + |
| +//static |
| +const Time* CurrentProcessInfo::CreationTime() { |
| + static Time process_creation_time = |
| + ProcessCreationTimeInternal(); |
| + return &process_creation_time; |
| +} |
| + |
| +} // namespace base |