home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HAM Radio 1
/
HamRadio.cdr
/
misc
/
kam401
/
kam-dos.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1989-02-26
|
2KB
|
114 lines
function Date: DateStr;
var
gm,gd,gy,gdow : word;
month,day: string[2];
year: string[2];
yr: string[4];
begin
GetDate(gy,gm,gd,gdow);
str(gy,yr); {convert to string}
str(gd,day); { " }
str(gm,month); { " }
year := ' ';
year[1] := yr[3];
year[2] := yr[4];
if (month[0] = ^A) then month := '0' + month;
if (day[0] = ^A) then day := '0' + day;
date := month+'/'+day+'/'+year;
end;
function time: TimeString;
var
gh,gm,gs,gs100 : word;
hour,min,sec: string[2];
begin
GetTime(gh,gm,gs,gs100);
str(gh, hour); {convert to string}
str(gm, min); { " }
if (hour[0] = ^A) then hour := '0' + hour;
if (min[0] = ^A) then min := '0' + min;
time := hour+':'+min;
end;
procedure get_time;
var gh,gm,gs,gs100 : word;
begin
GetTime(gh,gm,gs,gs100);
hour := gh;
min := gm;
end;
procedure get_date;
var gy,gm,gd,gdow : word;
begin
GetDate(gy,gm,gd,gdow);
year := gy;
month := gm;
day := gd;
end;
procedure set_time;
begin
SetTime(hour,min,0,0);
end;
procedure set_date;
begin
SetDate(year,month,day);
end;
procedure set_date_time;
begin
if (time_zone <> 0) then
begin
get_date;
get_time;
hour := hour + time_zone;
if (hour > 23) then
begin
hour := hour - 24;
day := day + 1;
if (day > nbr_days[month]) then
begin
day := 1;
month := month + 1;
if (month > 12) then
begin
month := 1;
year := year + 1;
end;
end;
end;
set_date;
set_time;
end;
end;
procedure reset_date_time;
begin
if (time_zone <> 0) then
begin
get_date;
get_time;
hour := hour - time_zone;
if (hour < 0) then
begin
hour := hour + 24;
day := day - 1;
if (day = 0) then
begin
month := month - 1;
if (month = 0) then
begin
month := 12;
year := year - 1;
end;
day := nbr_days[month];
end;
end;
set_date;
set_time;
end;
end;