Is there a way to find out the Elapsed Time Difference?

Share your macros, knowledge, solutions, services, ...
Post Reply
Petr
Posts: 106
Joined: Tue Oct 18, 2016 1:12 pm

Is there a way to find out the Elapsed Time Difference?

Post by Petr » Fri Nov 18, 2016 10:18 am

Q:

I created my own clock that counts 60 seconds that adds to 1 minute,
and 60 minutes adds to 1 hour. also I have a macro that counts in
reverse, like a countdown clock. I use to define how many hours/minutes
before a certain macro executes.

But my problem is when I have a macro that has a whole bunch of <wait>()
It gets pretty complicated counting all those waits (to count the elapsed time).

is there a datediff function?
------------------------------------------------------
A: It is possible to do calculations with time/date. I'm copying here a section from help file:

....
The expressions support also time arithmetic's. The time must be in appropriate format which is "YYYY.MM.DD HH:MM:SS". The difference between two times is "time span" that has this format "Days HH:MM:SS". The time span is also used to add/subtract amount of time to/from given time. This operations are supported:

"Days HH:Mi:SS" = "YYYY.MM.DD HH:Mi:SS" - "YYYY.MM.DD HH:Mi:SS"
"YYYY.MM.DD HH:Mi:SS" = "YYYY.MM.DD HH:Mi:SS" + "Days HH:Mi:SS"
"YYYY.MM.DD HH:Mi:SS" = "YYYY.MM.DD HH:Mi:SS" - "Days HH:Mi:SS"
"Days HH:Mi:SS" = "Days HH:Mi:SS"+"Days HH:Mi:SS"
"Days HH:Mi:SS" = "Days HH:Mi:SS"-"Days HH:Mi:SS"

Example 1:

Code: Select all

<varset>("vTomorrowDate=EXPR(%_vCurrDateTime_ForCalc%+1 0:0:0)","") <#> What date will be 1 day later (next day)?
Example 2:

Code: Select all

<varset>("vDate=EXPR(%_vCurrDateTime_ForCalc%-10 13:45:10)","") <#> What date was before 10 days, 13 hours, 45 minutes and 10 seconds?
Example 3:

Code: Select all

<varset>("vTimeSpan=EXPR(%_vCurrDateTime_ForCalc%-2005.11.21 13:45:00)","") <#> How much time left since 2005/11/21, 13:45:00?
....

In addition, Macro Toolworks have their own scheduler that allows to fire a macro on defined time/date. Maybe yo could use it for your purposes too....

Post Reply