DB : group manipulation
[apps/native/sample/adventure.git] / src / item.c
1 #include <system_settings.h>
2 #include <time.h>
3
4 void item_set_local_timezone(Evas_Object *item)
5 {
6         /* http://tizen.org/privilege/systemsettings */
7         char *timezone_str = NULL;
8         struct tm *local_time = NULL;
9
10         int ret = SYSTEM_SETTINGS_ERROR_NONE;
11         time_t t = 0;
12         char time_result[PATH_LEN] = {0, };
13
14         local_time = localtime(&t);
15         ret_if(!local_time);
16
17         ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE, &timezone_str);
18         if (ret != SYSTEM_SETTINGS_ERROR_NONE)
19                 _E("cannot get the timezone string");
20
21         /* Timezone
22            Asia/Seoul
23         */
24
25         if (local_time->tm_gmtoff >= 0)
26                 snprintf(time_result, sizeof(time_result), "%s, +%d", timezone_str, local_time->tm_gmtoff / 3600);
27         else
28                 snprintf(time_result, sizeof(time_result), "%s, %d", timezone_str, local_time->tm_gmtoff / 3600);
29
30         free(timezone_str);
31 }