2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.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
8 * http://www.tizenopensource.org/license
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.
17 #include "stopwatch_util.h"
20 #define UPTIME_FILE "/proc/uptime"
23 * This function is used to get system time
28 double stw_get_systime()
31 FILE *pFile = fopen(UPTIME_FILE, "r");
33 fscanf(pFile, "%lf", &sys_time);
41 * This function is used to get time_t time
42 * @param dval[in] double value, time
43 * @param type[in] STW_TIME_TYPE_USEC/STW_TIME_TYPE_SEC
47 time_t stw_systime_double_to_time_t(double dval, STW_TIME_TYPE type)
49 if (IS_EQUAL(0, dval)) {
53 case STW_TIME_TYPE_SEC:
55 case STW_TIME_TYPE_USEC:
59 double dval_dec = dval - (int)dval;
60 snprintf(array, sizeof(array), "%.2f", dval_dec);
61 res = (time_t) atoi(&array[2]);
71 * This function is used to set pm state
72 * @param isLock[in] a Eina_Bool value
73 * EINA_TRUE means lock power state, EINA_FALSE means unlock
77 void stw_util_pm_state_set(Eina_Bool isLock)
79 if (EINA_TRUE == isLock) {
80 pm_lock_state(LCD_NORMAL, GOTO_STATE_NOW, 0);
82 pm_unlock_state(LCD_NORMAL, PM_RESET_TIMER);