SetFixTime = GetFixTime - 60 seconds?

Hi, I’m stuck with a small thing:
I want to change the fixed time of an item to -60 seconds. How is this possible? I found a delphi function IncSecond() to change a TDateTime but this doesn’t seem to be available in mAirList scripting… Is there another way?

Hi Tim,

try to multiply the times with 86400 each (which is the number of seconds per day) and add th 60 seconds subsequently.
 

Converted regards

TSD

It had been late – rather like this:

SetFixTime := ((GetFixTime * 86400) + 60) / 86400

 
Insomnic regards

TSD

Tried that but it won’t work unfortunately :frowning_face:

Tried this:
CurrentPlaylist.GetItem(iStart).SetFixTime( round((CurrentPlaylist.GetItem(iStart).GetFixTime()*86400) - 60)/86400 );

But the FixTime just stays the same, weird…

I do not think it’s the formula, maybe the fault is located in the retrieving of the time values.

What are the parentheses after GetFixTime for? GetFixTime is a function which returns some value, no brackets needed there. You can try to put in a GetValue function afterwards. Maybe the machine doesn’t like the recursive acquiring of the time values either. You might want to try:

var
  FixTime: TDateTime;

begin
  FixTime := CurrentPlaylist.GetItem(iStart).GetFixTime.GetValue;
  FixTime := round((FixTime * 86400) - 60) / 86400);
  CurrentPlaylist.GetItem(iStart).SetFixTime(FixTime);
end.

Maybe you can skip the round()-function, too. Or try to use frac(), which returns the fractional part (i. e. the figures after the decimal point) of a number. (This, for TDateTime-variables, is the time portion, the date portion is retained in the integer numbers.)

Lastly there is a TimeToSeconds()-function which might work for you.

What I am doing in these cases is involving a button or text element to show these values. If it says 00:00, I know, there’s something wrong, for instance.

ExecuteCommand('BUTTON.4 TEXT ' + FormatDateTime('hh:nn:ss', FixTime));

All of these gimmicks I have encorporated in my backtiming script here (in German, alas, but just ask). Keep on trying, it will work some time! :wink:

Fixedly-timed regards

TSD

No idea, I’m used to programming in PHP :slight_smile: Apparently it doesn’t really matter in Delphi if you put brackets behind a function or not if it doesn’t have any arguments. Learned that now :slight_smile:

The .GetValue gave an error, and I removed the round(), for the rest I used your code and now it works!

Thanks!!!

Just for the record: The said function is properly named

TimeValueToSeconds( )

Sorry for the misspelling.

Discovered Regards

TSD

All dates and/or times are stored in Delphi’s TDateTime type (floating point, 1 = one day).

All durations are stored in mAirList’s TTimeValue type (1 = 1 second).

In ancient versions, TTimeValue used a different representation internally, that’s why the TimeValueToSeconds and SecondsToTimeValue functions were needed. Today you can safely assume that 1 TTimeValue unit represents 1 second, and just leave out these function calls.

2 Likes