1 //******************************************************************
3 // Copyright 2014 Samsung Electronics All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
38 #define SECS_PER_MIN (60L)
39 #define SECS_PER_HOUR (SECS_PER_MIN * 60L)
40 #define SECS_PER_DAY (SECS_PER_HOUR * 24L)
41 #define DAYS_PER_WEEK (7L)
42 #define SECS_PER_WEEK (SECS_PER_DAY * DAYS_PER_WEEK)
43 #define SECS_PER_YEAR (SECS_PER_WEEK * 52L)
44 #define SECS_YR_2000 (946684800L)
47 time_t timespec_diff(const time_t after, const time_t before);
48 void timespec_add(time_t * to, const time_t seconds);
52 long int getSeconds(struct tm* tp);
53 long int getRelativeIntervalOfWeek(struct tm* tp);
54 long int getSecondsFromAbsTime(struct tm* tp);
57 void *loop(void *threadid);
58 time_t registerTimer(const time_t seconds, int *id, void *cb);
59 void unregisterTimer(int id);
63 time_t timeToSecondsFromNow(tmElements_t *t);
64 time_t registerTimer(const time_t seconds, int *id, void (*cb)());
65 void unregisterTimer(int id);