Next: , Previous: , Up: Forth Words   [Contents][Index]


5.30 Keeping track of Time

ms ( n –  ) unknown “ms”
time&date ( – nsec nmin nhour nday nmonth nyear  ) facility-ext “time-and-date”

Report the current time of day. Seconds, minutes and hours are numbered from 0. Months are numbered from 1.

doc->time&date

utime ( – dtime ) gforth-0.5 “utime”

Report the current time in microseconds since some epoch. Use #1000000 um/mod nip to convert to seconds

ntime ( – dtime ) gforth-1.0 “ntime”

Report the current time in nanoseconds since some epoch.

cputime ( – duser dsystem ) gforth-0.5 “cputime”

duser and dsystem are the respective user- and system-level CPU times used since the start of the Forth system (excluding child processes), in microseconds (the granularity may be much larger, however). On platforms without the getrusage call, it reports elapsed time (since some epoch) for duser and 0 for dsystem.