Natools

Check-in [f4f3b7b682]
Login
Overview
Comment:tools/timekey: refactor the number of displayed subsecond digits
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f4f3b7b682b23b4aae51d6b1ed263f734a1c06a6
User & Date: nat on 2017-01-28 20:09:43
Other Links: manifest | tags
Context
2017-01-29
21:32
tools/timekey: add CLI option to configure numer of subsecond digits check-in: b40ac98134 user: nat tags: trunk
2017-01-28
20:09
tools/timekey: refactor the number of displayed subsecond digits check-in: f4f3b7b682 user: nat tags: trunk
2017-01-27
20:44
tools/timekey: refactor command-line argument processing check-in: f9d3f1aa38 user: nat tags: trunk
Changes

Modified tools/timekey.adb from [a21f1616f7] to [f35e7b972a].

27
28
29
30
31
32
33

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

50
51
52
53
54
55
56
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

50
51
52
53
54
55
56
57







+















-
+







   procedure Process_Input;
      --  Read lines from current input and process them.


   Input_Processed : Boolean := False;
   Empty : Boolean := True;
   Verbose : Boolean := False;
   Subsecond_Digits : Natural := Duration'Aft;


   procedure Process (Line : in String) is
   begin
      if Verbose then
         Ada.Text_IO.Put (Line);
      end if;

      if Natools.Time_Keys.Is_Valid (Line) then
         if Verbose then
            Ada.Text_IO.Put (" => ");
         end if;

         Ada.Text_IO.Put_Line
           (Natools.Time_IO.RFC_3339.Image
              (Natools.Time_Keys.To_Time (Line), Duration'Aft, False));
              (Natools.Time_Keys.To_Time (Line), Subsecond_Digits, False));

      elsif Natools.Time_IO.RFC_3339.Is_Valid (Line) then
         if Verbose then
            Ada.Text_IO.Put (" => ");
         end if;

         Ada.Text_IO.Put_Line
94
95
96
97
98
99
100
101

102
103
104
105
106
107
108
95
96
97
98
99
100
101

102
103
104
105
106
107
108
109







-
+








   if Empty then
      declare
         Now : constant Ada.Calendar.Time := Ada.Calendar.Clock;
      begin
         if Verbose then
            Ada.Text_IO.Put
              (Natools.Time_IO.RFC_3339.Image (Now, Duration'Aft, False)
              (Natools.Time_IO.RFC_3339.Image (Now, Subsecond_Digits, False)
               & " => ");
         end if;

         Ada.Text_IO.Put_Line (Natools.Time_Keys.To_Key (Now));
      end;
   end if;
end Timekey;