Advertisement
Garro

Ada - Server Time

Nov 11th, 2013
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ada 0.78 KB | None | 0 0
  1. with Ada.Text_IO; use Ada.Text_IO;
  2. with Ada.Calendar; use Ada.Calendar;
  3. with Ada.Calendar.Formatting; use Ada.Calendar.Formatting;
  4. with Ada.Calendar.Time_Zones; use Ada.Calendar.Time_Zones;
  5.  
  6. procedure Main is
  7.    task server is
  8.       entry checkTime;
  9.    end server;
  10.  
  11.    task body server is
  12.       Now : Time;
  13.    begin
  14.       loop
  15.          select
  16.             accept checkTime do
  17.                Now := Clock;
  18.                put("La fecha actual es: ");
  19.                Put_line(Image(Date => Now, Time_Zone => -3*60));
  20.             end checkTime;
  21.          end select;
  22.       end loop;
  23.    end server;
  24.  
  25.    task client;
  26.  
  27.    task body client is
  28.    begin
  29.       for I in Integer range 1 .. 10 loop
  30.          server.checkTime;
  31.       end loop;
  32.    end client;
  33.  
  34. begin
  35.    null;
  36. end Main;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement