1 /******************************************************************
3 * Copyright 2014 Samsung Electronics All Rights Reserved.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 ******************************************************************/
32 std::string SysTimer::MilliSecondTime()
36 time_t *p_time = NULL;
37 struct tm *localT = NULL;
38 char time_str[30] = {0,};
40 gettimeofday(&tv, NULL);
41 p_time = (time_t *) & (tv.tv_sec);
42 localT = localtime( p_time );
44 sprintf( time_str, "%04d-%02d-%02d %02d:%02d:%02d.%03ld", \
45 localT->tm_year + 1900, localT->tm_mon + 1, localT->tm_mday, \
46 localT->tm_hour, localT->tm_min, localT->tm_sec, \
50 std::string strTime = ss.str();
55 std::string SysTimer::MilliSecondAsString()
60 gettimeofday(&tv, NULL);
61 long long val = tv.tv_sec * (long long) 1000 + tv.tv_usec / 1000;
64 std::string strTime = ss.str();
69 std::string SysTimer::UTCSecondAsString()
74 gettimeofday(&tv, NULL);
75 unsigned long val = tv.tv_sec;
78 std::string strTime = ss.str();