Pascal/Turbo Pascal - Fecha y hora

 
Vista:

Fecha y hora

Publicado por Maxi (20 intervenciones) el 21/10/2013 14:08:36
Hola, necesito saber si es posible extraer la hora y fecha del sistema utilizando solo crt. Y si fuese posible saber como
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Fecha y hora

Publicado por ramon (2158 intervenciones) el 21/10/2013 18:49:31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
{Si usando Port mira}
 
program fechaora;
 uses
    crt;
 
   var
     hora, minut, segun : integer;
     dia, mes, ayo1, ayo2 : integer;
 
   function leer(d : integer) : integer;
   begin
      if (d < 0) or (d > 63) then
      leer := -1
   else
      begin
        Port[$70] := d;
        leer := Port[$71]
      end
    end;
 
   function datos(d : integer) : integer;
   var
      lor : integer;
      begin
        if (leer($0b) and 2 = 0) then
        datos := leer(d)
    else
       begin
         lor := leer(d);
         datos := (lor shr 4) * 10 + lor and 15
       end
     end;
 
  begin
     clrscr;
     if leer($0e) and 128 = 0 then
     begin
       hora := datos($04);
       minut := datos($02);
       segun := datos($00);
       dia := datos($07);
       mes := datos($08);
       ayo1 := datos($32);
       ayo2 := datos($09);
       write('  La hora  = ',hora,':',minut:2,':',segun:2);
       writeln;
       write('  La fecha = ',dia,'/', mes,'/',ayo1, ayo2);
     end;
     readkey;
   end.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar