by Christian Dietz, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
, Creation date: 2017-03-09, Last change: 2025-09-14
[t,tc]=RRcputime([RRtictime])
RRtictime: | only used for reset by tic |
t: | time difference since first call | |
tc: | CPUtime difference since first call |
This function, RRcputime, is designed to measure the real-time and CPU time differences since its first call. It is part of the SG-Library and was created by Christian Dietz in 2017.
tic.The function uses persistent variables RRtictime and RRcputime to store the initial time values. If an input argument is provided, it resets these variables using the input value for RRtictime and the current CPU time for RRcputime.
If RRtictime is empty, it initializes RRtictime with the current time using tic, sets t and tc to zero, and updates RRcputime with the current CPU time.
If RRtictime is not empty, it calculates the elapsed time t using toc(RRtictime). If a second output is requested, it calculates tc as the difference between the current CPU time and RRcputime.