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 "alarm_fwk_icu.h"
19 /**********************************************************************
20 ******************Global val , static global val*************************************
21 ***********************************************************************/
23 char *time_pattern[2] = {
24 STRING_ALARM_TIMEPATTEN_A,
25 STRING_ALARM_TIMEPATTEN,
28 /**********************************************************************
29 ******************Local function ref*************************************
30 ***********************************************************************/
32 static int __get_pattern_time(char *pattern, int num, CLK_TIME_FORMAT timeStyle)
34 retvm_if(!pattern, FAILED, "pattern null");
35 retvm_if(num <= 0, FAILED, "num<=0");
36 snprintf(pattern, num * sizeof(char) - 1, "%s",
37 time_pattern[timeStyle]);
38 //CLK_INFO_PURPLE("pattern=%s",pattern);
42 /**********************************************************************
43 ******************Global function ref*************************************
44 ***********************************************************************/
46 char *alarm_icu_get_time_str(time_t input_time, char *timezone,
47 CLK_TIME_FORMAT *pTimeFormat)
49 static char string_icu_time[BUF_SIZE_32] = { 0 };
50 char pattern[MAX_PATTERN_LENGHT] = { 0 };
51 CLK_TIME_FORMAT time_format;
52 time_format = clk_fwk_icu_time_format_get();
53 __get_pattern_time(pattern, MAX_PATTERN_LENGHT, time_format);
54 //CLK_INFO_PURPLE("pattern=%s",pattern);
55 clk_fwk_icu_get_data(input_time, string_icu_time, BUF_SIZE_32, NULL,
56 pattern, MAX_PATTERN_LENGHT, timezone);
57 // splice time string to result string
59 *pTimeFormat = time_format;
61 return string_icu_time;