Task

Output the system time   (any units will do as long as they are noted) either by a system command or one built into the language.

The system time can be used for debugging, network information, random number seeds, or something as simple as program performance.



Related task

   Date format


See also

   Retrieving system time (wiki)


include c:\cxpl\codes;          \include intrinsic 'code' declarations
 
proc NumOut(N);                 \Output a 2-digit number, including leading zero
int  N;
[if N <= 9 then ChOut(0, ^0);
IntOut(0, N);
]; \NumOut
 
int Reg;
[Reg:= GetReg;                  \get address of array with copy of CPU registers
Reg(0):= $2C00;                 \call DOS function 2C (hex)
SoftInt($21);                   \DOS calls are interrupt 21 (hex)
NumOut(Reg(2) >> 8);            \the high byte of register CX contains the hours
ChOut(0, ^:);
NumOut(Reg(2) & $00FF);         \the low byte of CX contains the minutes
ChOut(0, ^:);
NumOut(Reg(3) >> 8);            \the high byte of DX contains the seconds
ChOut(0, ^.);
NumOut(Reg(3) & $00FF);         \the low byte of DX contains hundreths
CrLf(0);
]