Get Time Now

There are many reasons why we may want Nyquist to know the current date or time. We may want to add the date to an exported file name, or we may want to measure how long it takes for a plug-in to run. In Nyquist 3.16 we can do this with (get-real-time).

For timing a long running Nyquist script, we can simply store the time when we start, then subtract that from the time at the end. As an example, we can count the number of samples have a value greater than 0 dB (a slow running process) and time how long it takes:

But what if we want the actual time now?

Given that “Epoch Time” began at 00:00:00 UTC, we can calculate the real UTC time now as the remainder after dividing Epoch Time by one day in seconds.

Nearly there, but we still only have the time in seconds. Fortunately, we can easily convert the time in seconds to hours, minutes and seconds, using a handy function: SS-TO-HHMMSS.

Example output:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.