2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: reutil.h /main/4 1995/11/09 12:51:01 rswiston $ */
25 * (c) Copyright 1993, 1994 Hewlett-Packard Company
26 * (c) Copyright 1993, 1994 International Business Machines Corp.
27 * (c) Copyright 1993, 1994 Novell, Inc.
28 * (c) Copyright 1993, 1994 Sun Microsystems, Inc.
37 #define EOT 2147483647
39 #define RE_DAILY(re) (re->re_data.re_daily)
40 #define RE_WEEKLY(re) (re->re_data.re_weekly)
41 #define RE_MONTHLY(re) (re->re_data.re_monthly)
42 #define RE_YEARLY(re) (re->re_data.re_yearly)
43 #define RES_DSTATE(res) (res->res_data.ds)
44 #define RES_WSTATE(res) (res->res_data.ws)
45 #define RES_MSTATE(res) (res->res_data.ms)
46 #define RES_YSTATE(res) (res->res_data.ys)
47 #define SAME_DAY(tm1, tm2) (((tm1)->tm_year == (tm2)->tm_year && \
48 (tm1)->tm_mon == (tm2)->tm_mon && \
49 (tm1)->tm_mday == (tm2)->tm_mday))
50 #define SAME_MONTH(tm1, tm2) (((tm1)->tm_year == (tm2)->tm_year && \
51 (tm1)->tm_mon == (tm2)->tm_mon))
52 #define TIME_OF_DAY(tm) ((tm)->tm_hour * 60 * 60 + \
55 #define TIMEOFMONTH(tm) (((tm)->tm_mday - 1) * 24 * 60 * 60 + \
56 (tm)->tm_hour * 60 * 60 + \
59 #define HOURTOSEC(time) ((time/100) * 60 * 60 + \
62 extern int GetWDayDiff(const int, const int);
63 extern int DayExists(const int, const int, const int);
64 extern WeekNumber GetWeekNumber(const Tick);
65 extern WeekNumber DayToWeekNumber(const Tick);
66 extern Tick WeekNumberToDay(const Tick, const WeekNumber, const WeekDay);
67 extern int OccurenceExists(const WeekDayTime *, const unsigned int, const Tick);
68 extern unsigned int DayOfMonth(const int, const int, const int);
69 extern int InTimeRange(const unsigned int, const Duration);
70 extern int same_week(struct tm *, struct tm *);
72 extern Tick ClosestTick(const Tick, const Tick, RepeatEvent *,
74 extern Tick NextTick(const Tick, const Tick, RepeatEvent *,
76 extern Tick PrevTick(const Tick, const Tick, RepeatEvent *,
78 extern Tick LastTick(const Tick, RepeatEvent *);
79 extern int CountEvents(Tick, RepeatEvent *re, CSA_date_time_entry *);
80 extern Tick DeriveNewStartTime(const Tick, RepeatEvent *old_re, const Tick,
81 const Tick, RepeatEvent *new_re);
84 #endif /* _REUTIL_H */