4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Venkatesha Sarpangala <sarpangala.v@samsung.com>, Jayoun Lee <airjany@samsung.com>,
7 * Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
29 int callback(alarm_id_t alarm_id)
34 printf("Alarm[%d] has expired at %s\n", alarm_id, ctime(¤t_time));
46 alarm_info_t alarm_info;
48 alarm_id_t alarm_id_1;
56 printf("current time: %s\n", ctime(¤t_time));
57 localtime_r(¤t_time, ¤t_tm);
59 alarm_info.start.year = 0;
60 alarm_info.start.month = 0;
61 alarm_info.start.day = 0;
63 alarm_info.end.year = 2008;
64 alarm_info.end.month = 12;
65 alarm_info.end.day = 31;
67 alarm_info.start.hour = current_tm.tm_hour;
68 alarm_info.start.min = current_tm.tm_min+1;
70 alarm_info.mode.day_of_week = 0;
71 alarm_info.mode.repeat = ALARM_REPEAT_MODE_ONCE;
73 alarm_info.activation = true;
74 alarm_info.auto_powerup = false;
76 result = alarm_create(&alarm_info, &alarm_id_1, &error_code);
79 printf("test 1 failed: %d\n", error_code);
83 alarm_info.start.min = current_tm.tm_min+2;
85 result = alarm_update(alarm_id_1, &alarm_info, &error_code);
88 printf("test 2 failed: %d\n", error_code);
98 int main(int argc, char** argv)
102 mainloop = g_main_loop_new(NULL, FALSE);
104 alarm_init(&error_code);
105 alarm_set_cb(callback, &error_code);
109 g_main_loop_run(mainloop);
111 alarm_fini(&error_code);