Files
TempleOS-Rijn/LT/Demo/DateTime.CPZ
T
2018-09-08 21:45:20 +02:00

35 lines
1.0 KiB
Plaintext

/*
An $LK,"LTDate","MN:LTDate"$ is a signed 64-bit date/time number
representing how many 49710ths of a second
since Christ. The reason it is this crazy
number is so that 32bits is exactly one day.
These numbers can be subtracted to get time
differences.
The time of day to the nearest 49710ths of a second
is stored in the lower 32-bits. The upper
32-bits hold the number of days since Christ.
$LK,"PrintF","MN:PrintF"$() and the file datetimes use
this format, otherwise you might want to
use $LK,"GetTimeStamp","MN:GetTimeStamp"$() for a higher frequency
timing, divide by $LK,"time_stamp_freq","MN:time_stamp_freq"$,
but this number is tied to your CPU's
clock frequency which is inexact when
converted to real-time.
*/
LTDate d=GetCurTimeLTDate;
I8 i;
for (i=0;i<48;i++)
PrintF("%%h%dD: %h*D\r\n",i,i,d);
CrLf;
for (i=0;i<20;i++)
PrintF("%%h%dT: %h*T\r\n",i,i,d);
PrintF("$$FG,PURPLE$$LTDate freq:%12.6f$$FG$$\r\n",0x100000000/24.0/60.0/60.0);