Index: src/platform/power_manager/xidle-example.cc |
diff --git a/src/platform/power_manager/xidle-example.cc b/src/platform/power_manager/xidle-example.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..980d3178474db2b620cde01a2aa88a9422b3094a |
--- /dev/null |
+++ b/src/platform/power_manager/xidle-example.cc |
@@ -0,0 +1,18 @@ |
+// Copyright (c) 2009 The Chromium OS 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 <inttypes.h> |
+#include <cstdio> |
+#include "power_manager/xidle.h" |
+ |
+int main(int argc, char *argv[]) { |
+ chromeos::XIdle idle; |
+ uint64 idleTime; |
+ if (idle.getIdleTime(&idleTime)) { |
+ printf("User has been idle for %" PRIu64 " milliseconds\n", idleTime); |
+ } else { |
+ printf("Cannot calculate idle time\n"); |
+ } |
+ return 0; |
+} |