home *** CD-ROM | disk | FTP | other *** search
- #ifndef __RELTIM__
- #define __RELTIM__
-
- //
- // Relative Time Strings.h
- //
-
- ////////////////////////
- // Constants
- ////////////////////////
- #define FOUR_YEAR_SECS 126230400 // 3 * 365 + 366
- #define YEAR_SECS 31536000
- #define LEAP_YEAR_SECS 31622400
- #define WEEK_SECS 604800
- #define DAY_SECS 86400
- #define HOUR_SECS 3600
- #define MINUTE_SECS 60
-
- #define YEAR_PLACES 6 // decimal places when displaying fractional
- #define MONTH_PLACES 5
- #define WEEK_PLACES 4
- #define DAY_PLACES 4
- #define HOUR_PLACES 3
- #define MINUTE_PLACES 2
-
- #define NUMBER_SEPARATOR '-'
-
- /*************** Displaying Types ***************/
- enum{ year = 0x0001,
- month = 0x0002,
- week = 0x0004,
- day = 0x0008,
- hour = 0x0010,
- minute = 0x0020,
- second = 0x0040,
-
- calendarDayMask = 0x000F, //use to determine if days should change at midnight
- allMask = 0x007F
- };
- typedef short Display_Items;
-
-
- struct Display_Type {
- Display_Items display_items;
- Display_Items last_item;
- Boolean clockDisplayEnable;
- Boolean fractional;
- Boolean significant;
- Boolean count_days;
- Boolean hide_zeros;
- Boolean allow_clock_display;
- Boolean allow_day_rounding;
- Boolean abbreviated;
- };
- typedef struct Display_Type Display_Type;
- typedef Display_Type *Display_Type_Ptr;
-
-
- struct Display_Elements {
- Boolean inPast;
- Boolean clockDisplay;
- Boolean count_days;
- Display_Items display_items;
- Display_Items last_item;
- unsigned long year;
- unsigned long month;
- unsigned long week;
- unsigned long day;
- unsigned long hour;
- unsigned long minute;
- unsigned long second;
- Str15 fractional;
- };
- typedef struct Display_Elements Display_Elements;
- typedef Display_Elements *Display_Elements_Ptr;
-
-
- /*********************************************
- * structure for keeping everything we need to know about each event.
- **********************************************/
-
- struct Count_Rec {
- unsigned long From_In_Secs;
- unsigned long Target_In_Secs;
- Display_Type Display;
- };
- typedef struct Count_Rec Count_Rec;
- typedef Count_Rec *Count_Rec_Ptr;
-
-
- ////////////////////////
- // Prototypes
- ////////////////////////
- void Calculate_Rel_Time_Str (Count_Rec_Ptr count_ptr, Display_Elements_Ptr element_ptr);
- void Get_Rel_Time_Str (Count_Rec_Ptr count_ptr, Str255 the_str);
- void Assemble_Time_String (Display_Elements_Ptr element_ptr, Str255 the_str, Boolean abrev_string);
-
- #endif
-