Previous | Next | Brown & Sharpe
Topic: DATE of printer
Conf: Brown & Sharpe, Msg: 1978
From: George Kovatchev (georgek@sitius.com)
Date: 6/23/2000 02:37 PM

Hi Mac,

Try this code:

program DT[WM1,WM2]
integer DAY, MONTH, YEAR, HOUR, MIN
! Your code ...
! Here comes the date
RDTIME
prn("Time: ",HOUR:2,":0",MIN:1," Date: ",MONTH:2,"/",DAY:2,"/",YEAR:4)

! More of your code
! ...
! Call RDTIME again before printing
RDTIME
prn("Time: ",HOUR:2,":0",MIN:1," Date: ",MONTH:2,"/",DAY:2,"/",YEAR:4)
endstat

procedure RDTIME
integer IDATE, ITIME
real RDATE
RDATE = date
ITIME = trunc(time)
IDATE = trunc(RDATE)
DAY = trunc(100 * (RDATE-IDATE))
YEAR = IDATE div 100
MONTH = IDATE - 100*YEAR
HOUR = ITIME div 100
MIN = ITIME - 100*HOUR
YEAR = YEAR + 1900
end_procedure

end_program

The "prn" should be one line, but this thing wraps the lines. It is very nice to put the RDTIME procedure in a separate file, e.g. "dnt.prc" and than use
#include c:\...\dnt.prc
in your program so you do not have to copy it every time and more importantly any changes to RDTIME take effect in all your programs.

Hope this helps.

George Kovatchev
Sitius Automation
http://www.sitius.com