Spinning My Wheels With Time Tokens and Time Value Comparisons

I've been just spinning my wheels on what should be a simple Macro but it just ain't happening for me. It's been months and I'm crying uncle here. I would appreciate any help with this...

Basically, I'm trying to record an online music streaming selections from a classical streaming station in Finland. (I love this station!) They publish their playlist with times in local Finland Time.

So, I figured I can get the start and end times in Finland Time, use REGEX and the TIME function to convert both Finland Times to Unix time, calculate the difference in seconds as delta time.

Then I would add this delta time to local time to control Audio HiJack recording software

With help from all the online help, I think I got the delta time correct. And I can successfully add the delta time to get the end time in local time, using the

%ICUDateTimePlus%DeltaTime%seconds%HH:mm:ss%

But after that, things go south for me.

I can add the delta time to the current local time. But if I have a "Wait for Current Time>= "EndTime" that calculation never seems to occur.

I'm not sure if the issues I'm having is my confusion about Time Tokens vs pure numeric variables or whether the time zone difference is also somehow entering into my issue.

Thanks in advance!
Glenn


BTW, I know that the variable "DiffTime" in the screen shot is not referenced anywhere. I just was trying something different and just gave up and asked for help.


TEST Finish Time 11-30-21.kmmacros (16.7 KB)

Hey Glen,

You're outputting HH:mm:ss.

  • That's not a valid time for calculations.
  • You need Unix (or Epoch) Time.

It's a common mistake.

See this:

KM Dates & Times: Notes on Anchors, Intervals, and Translations

Search for:

%Calculate%TIME(2015, 8, 23, 18, 44, 0)%

-Chris

Yes, I kinda figured that was a problem. I looked at your suggested reference post and it looks like something I need to get my head around. A quick view and I have to confess that I don't know what %Calculate% means in KM. I need to look that up too!

I wanted to share with group the complete code of what I had developed in August along the same lines. It seemed like the macro worked at first...but lately it stopped (maybe change to standard time?) My logic flow is very 'busy' in this macro and I've tried to get it working and improve it...without success.
So here is where I got to in August—

Stop Audio HiJack Recording from SAFARI- YLE FINLAND 08-23-21 Works.kmmacros|attachment (13.9 KB)

That's just how you perform a calculation in a text-token in a text-field instead of a calculation-field.

You can use the TIME() function in a pure calculation like this:

image

Incredibly, I didn't know about %Calculate%.

2 Likes

Ok, I went back to the macro finalized in August and found that a calculation had to be altered for Daylight Saving Time having ended. (I gave up on the approach to do it all in GMT with the time difference moved to local time.)

Here's a working macro for timing the start/stop recording of audio in a different time zone. Perhaps someone else might find it useful? (It also includes the use of the terminal command caffeinate to prevent the computer from sleeping while recording.)

Start-Stop Audio HiJack Recording from SAFARI- YLE FINLAND 12-02-21 Works* .kmmacros|attachment (21.6 KB)

Macro-Image