|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 7168 (0x1c00) Types: Ada Source Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Local_Time, seg_04cdd9, separate Calendar
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─⟦cfc2e13cd⟧ »Space Info Vol 2« └─⟦this⟧
separate (Calendar) package body Local_Time is type Tm is record Seconds : Day_Duration; Day : Day_Number; Month : Month_Number; Year : Year_Number; end record; ------------------------------------------------- -- Table of common Daylight Savings varieties. -- ------------------------------------------------- type Months is (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec); type Hemispheres is (Northern, Southern); This_Hemisphere : Hemispheres; type Dst_Rec is record Yr_In_Effect : Year_Number; Change_Month1 : Months; Change_Sunday_After1 : Day_Number; Change_Month2 : Months; Change_Sunday_After2 : Day_Number; Seconds : Time_Float; end record; --------------------------------------------------------------------------- -- ATTENTION: -- -- The following tables and constants need to be adjusted when the VADS -- -- is installed at a site not in the PACIFIC time zone. For the U.S. the -- -- dst table is correct everywhere that daylight savings applies. The -- -- only changes, then, are to the zone names and to hours_west_of_GMT. -- -- For example, in the Eastern time zone, "EDT", "EST", and 5 should do -- -- the trick. In Indiana, where no daylight savings applies, then these -- -- tables can be ignored, and the daylight_savings funtion can return -- -- 0.0 in all cases. -- -- -- -- If these tables are not adjusted, no disaster will occur. Dates are -- -- normalized to GMT (Grenwich Meridian Time) to provide uniformity on -- -- geographically interconnected machines. If these tables are not -- -- changed, then dates cannot be directly transfered (correctly) among -- -- these machines. -- --------------------------------------------------------------------------- ----------------------------------------------------------------------- -- dst (daylight savings time) for the PACIFIC time zone of the U.S. -- ----------------------------------------------------------------------- Dst_Zone_Name : constant String := "PDT"; Non_Dst_Zone_Name : constant String := "PST"; Hours_West_Of_Gmt : constant := 8; Dst_Entries : constant := 3; ------------------------------------------------------------------ -- valid for most of the U.S.; Indiana has no DST, for example. -- ------------------------------------------------------------------ Dst_Table : constant array (1 .. Dst_Entries) of Dst_Rec := ((1974, Jan, 6, Nov, 24, 3600.0), (1975, Mar, 1, Oct, 25, 3600.0), (1976, Apr, 24, Oct, 25, 3600.0)); ------------------------------------------------------ -- End of material to change, if the above daylight -- -- savings time model applies. -- ------------------------------------------------------ function Clock return Time is Day : Integer; Sec : Duration; procedure Ts_Current_Time (Day : out Integer; Sec : out Duration); pragma Interface (Ada, Ts_Current_Time); pragma Interface_Name (Ts_Current_Time, "TS_CURRENT_TIME"); begin Ts_Current_Time (Day, Sec); return (Day, Sec); exception when Numeric_Error => raise Time_Error; end Clock; function Sunday_After (Y : Year_Number; M : Months; D : Day_Number) return Integer is Jday : Integer := Julian_Day_Of (Y, Months'Pos (M) + 1, D); begin -- the 0th julian day was a monday. return ((Jday / 7) * 7) + 6; end Sunday_After; function Daylight_Savings (Year, Julian_Day : Integer) return Time_Float is Change1, Change2 : Integer; begin for I in reverse 1 .. Dst_Entries loop if Year >= Dst_Table (I).Yr_In_Effect then Change1 := Sunday_After (Year, Dst_Table (I).Change_Month1, Dst_Table (I).Change_Sunday_After1); Change2 := Sunday_After (Year, Dst_Table (I).Change_Month2, Dst_Table (I).Change_Sunday_After2); if Julian_Day >= Change1 and then Julian_Day < Change2 then if This_Hemisphere = Northern then return Dst_Table (I).Seconds; else return 0.0; end if; else if This_Hemisphere = Northern then return 0.0; else return Dst_Table (I).Seconds; end if; end if; end if; end loop; return 0.0; -- date was before dst went into effect end Daylight_Savings; begin This_Hemisphere := Northern; Seconds_From_Gmt := Time_Float (Hours_West_Of_Gmt) * 3600.0; -- Initialize clock to some arbitrary time Set_Clock (Time_Of (Year => 1987, Month => 10, Day => 15, Seconds => 0.0)); end Local_Time;
nblk1=6 nid=0 hdr6=c [0x00] rec0=23 rec1=00 rec2=01 rec3=018 [0x01] rec0=0c rec1=00 rec2=02 rec3=05a [0x02] rec0=10 rec1=00 rec2=03 rec3=048 [0x03] rec0=1b rec1=00 rec2=04 rec3=02e [0x04] rec0=15 rec1=00 rec2=05 rec3=010 [0x05] rec0=11 rec1=00 rec2=06 rec3=000 tail 0x217541e66874f7b8be408 0x42a00088462060003