home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / TIMEZONE.ZIP / TIMEZONE.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1987-02-14  |  5.8 KB  |  198 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.      cursor_off   = ^['x5';
  41.      cursor_on    = ^['y5';
  42.  
  43.      gmtoff : nums = ( 7, -4, 8, 13, 7, 14, 8, -5, 11, 1, 7, 7, 3, 8, 11, 0,
  44.                        7, 8, 11, -1, 6, 16, 7, 7, 1, 8, 14, -1, 8, 8, 8, 7,
  45.                        6, -2, 7, 14, 9, 1, 7, 7, 6, 3, 7, 14, 15, 14, 7, 16,
  46.                        9, 8, 15, 7, 7, 1);
  47.  
  48.      citys : list =  ( 'Amsterdam', 'Anchorage', 'Athens', 'Bangkok',
  49. 'Barcelona', 'Beijing', 'Beirut', 'Berlin', 'Bombay*', 'Boston', 'Brussels',
  50. 'Budapest', 'Buenos Aires', 'Cairo', 'Calcutta*', 'Chicago', 'Copenhagen',
  51. 'Damascus', 'Delhi*', 'Denver', 'Dublin', 'Fairbanks', 'Frankfurt', 'Geneva',
  52. 'Havana', 'Helsinki', 'Hong Kong', 'Honolulu', 'Istanbul', 'Jerusalem',
  53. 'Johannesburg', 'Lisbon', 'London', 'Los Angeles', 'Madrid', 'Manila',
  54. 'Moscow', 'New York', 'Oslo', 'Paris', 'Reykjavik', 'Rio de Janeiro', 'Rome',
  55. 'Saigon', 'Seoul', 'Singapore', 'Stockholm', 'Sydney', 'Tehran*', 'Tel Aviv',
  56. 'Tokyo', 'Vienna', 'Warsaw', 'Washington, DC');
  57.  
  58.  
  59. var
  60.    second, minute, hour : integer;
  61.    stop : integer;
  62.    last_time : integer;
  63.    check : boolean;
  64.  
  65. procedure set_time; (* custom this for your system to get the hour
  66.                        minute and seconds from your clock *)
  67.  
  68. var time : string[6];
  69.     result : integer;
  70.     Len_time : integer;
  71.  
  72.                         (* At The End Of This Procedure You Must Have
  73.                            The Value Of The Hour In The Integer Variable
  74.                            Hour, The Minutes In The Integer Variable
  75.                            Minute, The Seconds In The Integer Variable
  76.                            Second.  This Program Requires Military
  77.                            Time. i.e. 3 pm is 15 hundred hours
  78.                         *)
  79.  
  80. begin
  81.  
  82.    repeat
  83.    write (con, chr(27),'e');
  84.    read (kbd, time);
  85.    len_time := length(time);
  86.    val(copy(time, len_time-1, 2), second, result);
  87.    until (last_time < second) or (last_time = 59);
  88.  
  89.    val(copy(time, 1, len_time-4), hour, result);
  90.  
  91.    val(copy(time, len_time-3, 2), minute, result);
  92.  
  93.    last_time := second;
  94.  
  95. end;
  96.  
  97.  
  98. procedure print_citys;
  99.  
  100. var
  101.    y : integer;
  102.  
  103.  
  104. begin
  105. clrscr;
  106.  
  107.    for y := 1 to r do
  108.        writeln (citys[y]:15,citys[y+r]:26,citys[y+(2*r)]:26);
  109.  
  110.    writeln ('');
  111.    writeln ('');
  112.    Writeln ('':19,'TimeZone Version 1.10 Writen In TURBO Pascal');
  113.    writeln ('':24,'Copywrite [c] 1986, Public Domain');
  114.    writeln ('':30,'Writen By Ken Isacson');
  115.  
  116. end;
  117.  
  118. procedure print_to_screen(x : integer; check : boolean; y : integer; sub : integer);
  119.  
  120. var display : integer;
  121.  
  122. begin
  123.  
  124. display := hour + gmtoff[sub];
  125.  
  126. gotoxy(x,y);
  127.  
  128. case display of
  129.   0..23  : write(display:2);
  130.  24..48  : write(display - 24:2);  (* 48 to play its safe *)
  131. -12..-1 : write(display + 24:2);
  132. end;
  133.  
  134. write (':');
  135.  
  136. if check then
  137. case minute of
  138.      0..29 : write(minute + 30:2);
  139.     30..59 : write(minute - 30:2);
  140. end
  141. else write(minute:2);
  142. write (':',second:2);
  143.  
  144. end;
  145.  
  146. procedure print_time;
  147.  
  148. var
  149.    y : integer;
  150.  
  151. begin
  152.    for y := 1 to r do
  153.        begin
  154.        case y of
  155.        9  : check := true;
  156.        15 : check := true;
  157.        else check := false;
  158.        end;
  159.        print_to_screen (17, check, y, y);
  160.  
  161.        case y of
  162.        1 : check := true;
  163.        else check := false;
  164.        end;
  165.        print_to_screen (43, check, y, y+r);
  166.  
  167.  
  168.        case y of
  169.        13 : check := true;
  170.        else check := false;
  171.        end;
  172.        print_to_screen (69, check, y, y + 2*r);
  173.  
  174.        end;
  175. end;
  176.  
  177. BEGIN (* main program *)
  178. write (cursor_off);
  179.  
  180. set_time;
  181. if (second <> 0) then stop := pred(second) else stop := 59;
  182.  
  183. print_citys;
  184.  
  185. repeat
  186. set_time;
  187. print_time;
  188. until second = stop; (* This loop will only stop the program after 59 seconds
  189.                         To Stop The Program You Need To Punch In
  190.                         Control S and the Control C.
  191.                         To Have The Program Run Indefinetly Change This
  192.                         Line From until second = stop; to read
  193.                                         second = 60;
  194.                      *)
  195. write (cursor_on);
  196. gotoxy (1,24);
  197. end.
  198.