Merging tizen into ckm. Stage 1.
[platform/core/test/security-tests.git] / src / framework / src / test_results_collector_commons.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 /*
17  * @file        test_results_collector_commons.cpp
18  * @author      Lukasz Wrzosek (l.wrzosek@samsung.com)
19  * @author      Marcin Niesluchowski (m.niesluchow@samsung.com)
20  * @version     1.0
21  * @brief       Source file containing definitions of collectors common
22  *              functions
23  */
24
25 #include "dpl/test/test_results_collector_commons.h"
26
27 namespace DPL {
28 namespace Test {
29
30 double get_milliseconds (const std::chrono::system_clock::duration& performanceTime)
31 {
32     return (static_cast<double>(std::chrono::duration_cast<std::chrono::microseconds>
33             (performanceTime).count()))/1000.0;
34 }
35
36 bool ParseCollectorFileArg(const std::string &arg, std::string &filename)
37 {
38     const std::string argname = "--file=";
39     if (arg.find(argname) == 0 ) {
40         filename = arg.substr(argname.size());
41         return true;
42     }
43     return false;
44 }
45
46 } // namespace Test
47 } // namespace DPL
48