#!
( "...<eol>" -- )
=> "EXTENSIONS"
ignores the rest of the line,
defining `#!' is used to support forth scripts
executed by the unix kernel
primitive code = [p4_ignore_line]
GETTIMEOFDAY
( -- milliseconds# epochseconds# )
[EXT]
=> "EXTENSIONS"
returns SVR/BSD gettimeofday(2).
Incompatible with 16-bit systems as the numbers can not be properly
represented, hence TIME&DATE
is more portable.
primitive code = [gettimeofday]
MS@
( -- milliseconds# )
[EXT]
=> "EXTENSIONS"
elapsed time since start of process (or system) - in millseconds.
The granularity is per clock ticks as per ENVIRONMENT CLOCKS_PER_SEC
For the current wall clock in milliseconds, ask GETTIMEOFDAY
.
Remember that the process clock will wrap around at some point,
therefore only use difference values between two clock reads.
Also note that on many desktop systems the process scheduler ticks
per 1/100s or 1/60s so that the difference of two continuous reads
of the process clock will show steps of 10 to 16 milliseconds.
see also CLOCK@
and MS
primitive code = [p4_milliseconds_fetch]
CLOCK@
( --- clock-ticks# )
[EXT]
=> "EXTENSIONS"
return clock(2) - the number of clocks of this process.
To get the number of seconds, divide by CLOCKS_PER_SEC
as represented in the ENVIROMENT
for a hosted forth system.
A similar scheme is used by MS@
to compute the clock time
rounded to milliseconds (named in similarity with MS
sleep).
Remember that the process clock will wrap around at some point,
therefore only use difference values between two clock reads.
primitive code = [p4_clock_fetch]