home *** CD-ROM | disk | FTP | other *** search
- //----------------------------------------------------------------------------------------------------
- //
- // Clock Types and Constants
- //
- // Clock relies on the 'tm' struct to record its clock and alarm time values.
- // Associated defines and macros are based on that struct.
- // (Some members are not currently used.)
- //
- // struct tm {
- // int tm_sec; ( 0-59 seconds )
- // int tm_min; ( 0-59 minutes )
- // int tm_hour; ( 0-23 hour ( 0 is midnite) )
- // int tm_mday; ( 1-31 day of month )
- // int tm_mon; ( 0-11 month )
- // int tm_year; ( 0- year - 1900 )
- // int tm_wday; ( 0-6 day of week (Sunday = 0) )
- // int tm_yday; ( 0-365 day of year ) (Not Used)
- // int tm_isdst; ( flag: daylight savings time in effect ) (Not Used)
- // long tm_gmtoff; ( offset from GMT in seconds ) (Not Used)
- // char *tm_zone; ( abbreviation of timezone name ) (Not Used)
- // };
- //
- //
- // Disclaimer
- //
- // You may freely copy, distribute and reuse this software and its
- // associated documentation. I disclaim any warranty of any kind,
- // expressed or implied, as to its fitness for any particular use.
- //
- //----------------------------------------------------------------------------------------------------
- #import <sys/time.h>
-
-
- #define SUNDAY 0
- #define MONDAY 1
- #define TUESDAY 2
- #define WEDNESDAY 3
- #define THURSDAY 4
- #define FRIDAY 5
- #define SATURDAY 6
-
-
- #define JANUARY 0
- #define FEBRUARY 1
- #define MARCH 2
- #define APRIL 3
- #define MAY 4
- #define JUNE 5
- #define JULY 6
- #define AUGUST 7
- #define SEPTEMBER 8
- #define OCTOBER 9
- #define NOVEMBER 10
- #define DECEMBER 11
-
-
- #define SECOND(tm) ((tm)->tm_sec)
- #define MINUTE(tm) ((tm)->tm_min)
- #define HOUR(tm) ((tm)->tm_hour)
- #define DAY(tm) ((tm)->tm_mday)
- #define MONTH(tm) ((tm)->tm_mon)
- #define YEAR(tm) ((tm)->tm_year)
- #define WEEKDAY(tm) ((tm)->tm_wday)
-
- #define SECONDS(tm) (HOUR(tm) * 3600 + MINUTE(tm) * 60 + SECOND(tm))