forked from zhchbin/chromium-base
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cc
35 lines (30 loc) · 1.02 KB
/
main.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2013 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/at_exit.h"
#include "base/location.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/files/file_util.h"
#include "base/time/time.h"
#include "base/logging.h"
int main(int argc, char* argv[]) {
base::AtExitManager exit_manager;
if (argc <= 1) {
LOG(INFO) << argv[0] << ": missing operand";
return -1;
}
int duration_seconds = 0;
if (!base::StringToInt(argv[1], &duration_seconds) ||
duration_seconds < 0) {
LOG(INFO) << argv[0] << ": invalid time interval '" << argv[1] << "'";
return -1;
}
base::TimeDelta duration = base::TimeDelta::FromSeconds(duration_seconds);
base::MessageLoop main_loop;
base::RunLoop run_loop;
main_loop.PostDelayedTask(FROM_HERE, run_loop.QuitClosure(), duration);
run_loop.Run();
return 0;
}