OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gnat.dg/] [opt7.adb] - Blame information for rev 774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 696 jeremybenn
-- { dg-do compile }
2
-- { dg-options "-Os -g" }
3
 
4
with Opt7_Pkg;
5
 
6
package body Opt7 is
7
 
8
   procedure Parse (Str       :     String;
9
                    Time_Type : out time_t;
10
                    Abs_Time  : out Time;
11
                    Delt_Time : out Duration) is
12
      Year         : Year_Number;
13
      Month        : Month_Number;
14
      Day          : Day_Number;
15
      Minute       : Integer := 0;
16
      Idx          : Integer := Str'First;
17
      Ch           : Character := Str (Idx);
18
      Current_Time : Time;
19
 
20
   begin
21
      if Ch = '-' then
22
         Time_Type := Absolute_Time;
23
         Current_Time := Clock;
24
         Day   := Ada.Calendar.Day (Current_Time);
25
         Month := Ada.Calendar.Month (Current_Time);
26
         Year  := Ada.Calendar.Year (Current_Time);
27
      else
28
         Time_Type := Delta_Time;
29
      end if;
30
      while Ch in '0' .. '9' loop
31
         Minute := Minute + Character'Pos (Ch);
32
         Idx := Idx + 1;
33
         Ch  := Str (Idx);
34
      end loop;
35
      if Time_Type = Absolute_Time then
36
         Abs_Time := Time_Of (Year, Month, Day, Day_Duration (1));
37
      else
38
         Delt_Time := Duration (Float (Minute));
39
      end if;
40
   exception
41
      when others => Opt7_Pkg.My_Raise_Exception;
42
   end;
43
 
44
end Opt7;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.