Time/CPU Cycles

Intel/AMD have an inst that returns the num of CPU cycles since boot. This is not a steady, calibrated real time value. TempleOS measures it and you can convert with cnts.time_stamp_freq, a value continuously calibrated from other cnts. BIOSRep Funct Wrapper around SysRep() to only show BIOS info. Busy Funct Loosely timed. CPURep Funct Report number of cores and clock freq. Dput Funct Copy directory tree. Dsync Funct { GetTSC Funct _extern SYS_INITRAMFS_PTR U8* sys_initramfs_ptr; PortNop Funct Innoculous (reads IRQ Mask) which should take fixed time ProbeComm Funct { SNAIL_COM GlbVar I8 SNAIL_COM=-1; SNAIL_PORT GlbVar I64 SNAIL_PORT=-1; StartTOSServer Funct TODO SysRep Funct Display info of SMBIOS structures. Returns cnt of displayed structures. SysRepLite Funct { SysRepSurvey Funct Display system info excluding sensative info cnts GlbVar CCntsGlbls cnts= {1,0,2676302000,2676302,2676302000,FALSE}; md5 Funct { md5buf Funct {

Time/Date

Dates are 32-bit signed ints representing the number of days since the birth of Christ. Negative values represent B.C.E. dates. DayOfWeek Funct Day of week, given 32-bit day since AD 0. FirstDayOfMon Funct First day of month, given 32-bit day since AD 0. FirstDayOfYear Funct First day of year, given 32-bit day since AD 0. LastDayOfMon Funct Last day of month, given 32-bit day since AD 0. LastDayOfYear Funct Last day of year, given 32-bit day since AD 0. YearStartDate Funct 32-bit day since AD 0, given year number. mon_start_days1 GlbVar U16 mon_start_days1[12]= mon_start_days2 GlbVar U16 mon_start_days2[12]=

Time/Date/CDate

TempleOS uses a 64-bit value, CDate, for date/time. The upper 32-bits are the days since Christ. The lower 32-bits store time of day divided by 4 billion which works out to 49710ths of a second. You can subtract two CDate's to get a time span. Use CDATE_FREQ to convert. Date2Struct Funct Cvt CDate to CDateStruct. Now Funct Current datetime. Str2Date Funct { Struct2Date Funct Cvt CDateStruct to CDate. local_time_offset GlbVar CDate local_time_offset;

Time/Jiffies

One jiffy is one time slice. cnts.jiffies returns time slices since boot. SysTimerRead reads the timer ticks since boot. It's not as fast as GetTSC. Use JIFFY_FREQ to convert cnts.jiffies. Use SYS_TIMER_FREQ to convert SysTimerRead. Sleep Funct Not for power-saving. It is to make a program pause without hogging the CPU. SleepUntil Funct Not for power-saving. It is to make a program pause without hogging the CPU. SysTimerRead Funct System timer count with overflow already handled. cnts GlbVar CCntsGlbls cnts= {1,0,2676302000,2676302,2676302000,FALSE};

Time/Seconds

Beat Funct Time in music beats. Blink Funct Return TRUE, then FALSE, then TRUE at given frequency. tM Funct Time in seconds synced to music subsystem. tS Funct Time since boot in seconds as a float.