Hi dear community
I do have a variable $currenttime geting like this
:local currenttime [/system clock get time]
but in my script I need to use $currenttime+110seconds
how can I get this new variable ??
( ) use these two to be able to add.
So, like this:
:local currenttime ([/system clock get time]+110s)
thanks a lot.
it just works )
It has all to do with the ( ) ![]()
I was just about to compile a very complex script for doing time operations. This has saved me so much. Thanks alot
If your using V7, you can also use [:timestamp] which is also current time, but does not wrap at midnight.
:put ([:timestamp] + 120s)
A more complete example:
{
# get current time into a variable
:local start [:timestamp]
# wait 5 seconds
:delay 5s
# show difference between now and the start (e.g. +5 seconds)
:put ([:timestamp] - $start)
# time can also be compared... so this is "true"
:put ([:timestamp] > $start)
}
I was just about to compile a very complex script for doing time operations. This has saved me so much. Thanks alot
There is the usual fallacy that nobody considers:
Adding 110s to 23:59:00 becomes 1d00:00:50,
and for example subtracting 110s from 00:01:00 becomes -00:00:50
so both cases have to be handled…