home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / date / timezone / timezone.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1994-04-24  |  5.6 KB  |  196 lines

  1. (*  The Data Used For This Program Was Derived From TIMEZONE.BAS Written By
  2.     Jeff Jansen Written Microsoft/Otrona BASIC-80 For The Attache Computer.
  3.     I Decided To Take Only The Idea And The Data From His Public Domain
  4.     Program And Translate It Into TURBO Pascal.  This Program Requires A
  5.     80 Column Width By 24 Row Crt.  A Minumum Of 76 Columns Is Needed.
  6.     What You Must Do Is Recompile The Program Under TURBO Pascal Program
  7.     TIMEZONE.PAS And Rewrite The set_time Procedure To Read The Clock
  8.     On Your System.  If You Do Not Have A Built-In Real Time Computer Clock
  9.     The TIMEZONE.COM File Should Work On Your System.  This Version Will
  10.     Only Display The Time For One Specific Time. Whereas If You Rewrite
  11.     The set_time Procedure You Will Have A Program That Will Dispaly The
  12.     Correct Time For One Minute Or Indefinetly If The Line That Reads
  13.     until second = stop; Is Changed To until second = 60;
  14.  
  15.     This Program Is Only For Public Domain Use And Is Not For Sale In
  16.     ANY FORM WHAT SO EVER.  Copyright [c] 1986. Version 1.00
  17.     Writen By Ken Isacson On The Heathkit H89A With Turbo Pascal
  18.                                                     Ver. 3.01A
  19.  
  20. 01/03/1986
  21.  
  22.     Added print_to_screen routine To Replace Triple Program Section
  23.     To Make Program More Versatile With Only One print_to_screen
  24.     Code Section Instead Of Three Sections.
  25.  
  26.                                                  Version 1.10
  27. 01/03/1986
  28.  
  29. *)
  30.  
  31. program timezone_pas;
  32.  
  33. type
  34.      list = array[1..54] of string[15];
  35.      nums = array[1..54] of integer;
  36.  
  37. const
  38.      num_of_citys = 54;
  39.      r            = 18; (* number of citys div 3 *)
  40.  
  41.      gmtoff : nums = ( 7, -4, 8, 13, 7, 14, 8, -5, 11, 1, 7, 7, 3, 8, 11, 0,
  42.                        7, 8, 11, -1, 6, 16, 7, 7, 1, 8, 14, -1, 8, 8, 8, 7,
  43.                        6, -2, 7, 14, 9, 1, 7, 7, 6, 3, 7, 14, 15, 14, 7, 16,
  44.                        9, 8, 15, 7, 7, 1);
  45.  
  46.      citys : list =  ( 'Amsterdam', 'Anchorage', 'Athens', 'Bangkok',
  47. 'Barcelona', 'Beijing', 'Beirut', 'Berlin', 'Bombay*', 'Boston', 'Brussels',
  48. 'Budapest', 'Buenos Aires', 'Cairo', 'Calcutta*', 'Chicago', 'Copenhagen',
  49. 'Damascus', 'Delhi*', 'Denver', 'Dublin', 'Fairbanks', 'Frankfurt', 'Geneva',
  50. 'Havana', 'Helsinki', 'Hong Kong', 'Honolulu', 'Istanbul', 'Jerusalem',
  51. 'Johannesburg', 'Lisbon', 'London', 'Los Angeles', 'Madrid', 'Manila',
  52. 'Moscow', 'New York', 'Oslo', 'Paris', 'Reykjavik', 'Rio de Janeiro', 'Rome',
  53. 'Saigon', 'Seoul', 'Singapore', 'Stockholm', 'Sydney', 'Tehran*', 'Tel Aviv',
  54. 'Tokyo', 'Vienna', 'Warsaw', 'Washington, DC');
  55.  
  56.  
  57. var
  58.    second, minute, hour : integer;
  59.    stop : integer;
  60.    last_time : integer;
  61.    check : boolean;
  62.  
  63. procedure set_time; (* custom this for your system to get the hour
  64.                        minute and seconds from your clock *)
  65.  
  66. var time : string[6];
  67.     result : integer;
  68.     Len_time : integer;
  69.  
  70.                         (* At The End Of This Procedure You Must Have
  71.                            The Value Of The Hour In The Integer Variable
  72.                            Hour, The Minutes In The Integer Variable
  73.                            Minute, The Seconds In The Integer Variable
  74.                            Second.  This Program Requires Military
  75.                            Time. i.e. 3 pm is 15 hundred hours
  76.                         *)
  77.  
  78. begin
  79.  
  80.    repeat
  81.  
  82.    read(time);
  83.    len_time := length(time);
  84.    val(copy(time, len_time-1, 2), second, result);
  85.    until (last_time < second) or (last_time = 59);
  86.  
  87.    val(copy(time, 1, len_time-4), hour, result);
  88.  
  89.    val(copy(time, len_time-3, 2), minute, result);
  90.  
  91.    last_time := second;
  92.  
  93. end;
  94.  
  95.  
  96. procedure print_citys;
  97.  
  98. var
  99.    y : integer;
  100.  
  101.  
  102. begin
  103.    clrscr;
  104.  
  105.    for y := 1 to r do
  106.        writeln (citys[y]:15,citys[y+r]:26,citys[y+(2*r)]:26);
  107.  
  108.    writeln ('');
  109.    writeln ('');
  110.    Writeln ('':19,'TimeZone Version 1.10 Writen In TURBO Pascal');
  111.    writeln ('':24,'Copywrite [c] 1986, Public Domain');
  112.    writeln ('':30,'Writen By Ken Isacson');
  113.  
  114. end;
  115.  
  116. procedure print_to_screen(x : integer; check : boolean; y : integer; sub : integer);
  117.  
  118. var display : integer;
  119.  
  120. begin
  121.  
  122. display := hour + gmtoff[sub];
  123.  
  124. gotoxy(x,y);
  125.  
  126. case display of
  127.   0..23  : write(display:2);
  128.  24..48  : write(display - 24:2);  (* 48 to play its safe *)
  129. -12..-1 : write(display + 24:2);
  130. end;
  131.  
  132. write (':');
  133.  
  134. if check then
  135. case minute of
  136.      0..29 : write(minute + 30:2);
  137.     30..59 : write(minute - 30:2);
  138. end
  139. else write(minute:2);
  140. write (':',second:2);
  141.  
  142. end;
  143.  
  144. procedure print_time;
  145.  
  146. var
  147.    y : integer;
  148.  
  149. begin
  150.    for y := 1 to r do
  151.        begin
  152.        case y of
  153.        9  : check := true;
  154.        15 : check := true;
  155.        else check := false;
  156.        end;
  157.        print_to_screen (17, check, y, y);
  158.  
  159.        case y of
  160.        1 : check := true;
  161.        else check := false;
  162.        end;
  163.        print_to_screen (43, check, y, y+r);
  164.  
  165.  
  166.        case y of
  167.        13 : check := true;
  168.        else check := false;
  169.        end;
  170.        print_to_screen (69, check, y, y + 2*r);
  171.  
  172.        end;
  173. end;
  174.  
  175. BEGIN (* main program *)
  176.  
  177.  
  178. set_time;
  179. if (second <> 0) then stop := pred(second) else stop := 59;
  180.  
  181. print_citys;
  182.  
  183. repeat
  184. set_time;
  185. print_time;
  186. until second = stop; (* This loop will only stop the program after 59 seconds
  187.                         To Stop The Program You Need To Punch In
  188.                         Control S and the Control C.
  189.                         To Have The Program Run Indefinetly Change This
  190.                         Line From until second = stop; to read
  191.                                         second = 60;
  192.                      *)
  193.  
  194. gotoxy (1,24);
  195. end.
  196.