Maximum time of tic-toc function

26 ビュー (過去 30 日間)
MENGZE WU
MENGZE WU 2024 年 10 月 31 日 6:04
回答済み: Walter Roberson 2024 年 10 月 31 日 6:18
I was measuring data every 10 minutes for a week. In every measurement, I also need to record current time (don’t need be very accurate). I’m doing this by putting a tic at the start of the script and call toc on every measurement and save it as current time. I’m measuring for a week which is 604800 second. The tic-toc is using a 64 bit counter, so it probably won’t overflow. Is there a potential problem with this tic toc approach? Thanks!

回答 (1 件)

Walter Roberson
Walter Roberson 2024 年 10 月 31 日 6:18
To measure time, you could instead initialize a variable to the current time, and then
elapsed_time = datetime('now') - base_time;

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by