[comp.lang.pascal] Time of Day

specter@disk.UUCP (Byron Max Guernsey) (12/10/89)

I need some help. I am using TP v3 and I need to read from the time of day clock
to get the time/date. Does anyone have a procedure or can easily write one to
demonstrate it? Don't tell me "Download my pascal library from ftp site blah.foo
" because I don't have FTP on my side. :-> Well if you can help, please do! 
Thanks...

								-Byron

-- 
Byron 'Maxwell' Guernsey                      |       ///  //\\
specter@disk.UUCP     or                      |      ///  //  \\
uunet!ukma!corpane!disk!specter               |  \\\///  //====\\
"All we are, is dust in the wind dude!" - Ted |   \\\/  //      \\ m i g a

reino@cs.eur.nl (Reino de Boer) (12/15/89)

specter@disk.UUCP (Byron Max Guernsey) writes:

>I need some help. I am using TP v3 and I need to read from the time of day clock
>to get the time/date. Does anyone have a procedure or can easily write one to
>demonstrate it? 

Your manual contains an example of a type Registers = record ...
declaration. Use this declaration for the following:

procedure get_date( var tm_wday : byte; var tm_year : integer; tm_month, tm_day 
	: byte );
	{ tm_wday = day of week ( 0 = Sunday, 1 = Monday, and so on 
	  tm_year = 1980 through 2099 }
	var cpu : registers;
	begin
	  cpu.ah := $2A;
	  msdos( cpu );
	  with cpu do begin
		tm_wday := al;
		tm_year := cx;
		tm_month := dh;
		tm_day := dl
	  end
	end;

A similar procedure can be written to get the time of day (function $2C,
where returned registers contain: 
ch = hours, cl = minutes, dh = seconds, and dl = hundreds of second.

Hope this helps -- Reino

-- 
Reino R. A. de Boer
Erasmus University Rotterdam ( Informatica )
e-mail: reino@cs.eur.nl

leonard@bucket.UUCP (Leonard Erickson) (12/18/89)

To read the Time or Date for MS-DOS Turbo Pascal V3, check the code
in the files DOSFCALL.DOC & INTRPTCL.DOC on your master disks.

It's also described in the manual in the sections on using interrupts
and DOS calls.
-- 
Leonard Erickson		...!tektronix!reed!percival!bucket!leonard
CIS: [70465,203]
"I'm all in favor of keeping dangerous weapons out of the hands of fools.
Let's start with typewriters." -- Solomon Short