OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 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 <stdio.h> |
| 6 |
| 7 #include "base/at_exit.h" |
| 8 #include "base/location.h" |
| 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" |
| 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/time/time.h" |
| 13 |
| 14 int main(int argc, char* argv[]) { |
| 15 base::AtExitManager exit_manager; |
| 16 |
| 17 if (argc <= 1) { |
| 18 printf("%s: missing operand\n", argv[0]); |
| 19 return -1; |
| 20 } |
| 21 |
| 22 int duration_seconds = 0; |
| 23 if (!base::StringToInt(argv[1], &duration_seconds) || |
| 24 duration_seconds < 0) { |
| 25 printf("%s: invalid time interval `%s'\n", argv[0], argv[1]); |
| 26 return -1; |
| 27 } |
| 28 |
| 29 base::TimeDelta duration = base::TimeDelta::FromSeconds(duration_seconds); |
| 30 |
| 31 base::MessageLoop main_loop; |
| 32 |
| 33 base::RunLoop run_loop; |
| 34 |
| 35 main_loop.PostDelayedTask(FROM_HERE, run_loop.QuitClosure(), duration); |
| 36 |
| 37 run_loop.Run(); |
| 38 |
| 39 return 0; |
| 40 } |
OLD | NEW |