Page 1 of 2
SC <date> and milliseconds?
Posted: 07 Jan 2018 09:17
by Filehero
Hi,
what's the proper syntax to get a time including milliseconds for further processing with
datediff?
Thanks, FH
Re: SC <date> and milliseconds?
Posted: 07 Jan 2018 09:28
by jupe
Here is a post I found useful about date variables, according to it is "ffffff" eg. <date YYYY-MM-DD hh:nn:ssffffff>
viewtopic.php?f=3&t=14299
Re: SC <date> and milliseconds?
Posted: 07 Jan 2018 09:53
by Filehero
Hi jupe,
thanks.

Sometimes the forum search is .....
Seems there's only direct support for microseconds but not milliseconds, but that's ok.
Re: SC <date> and milliseconds?
Posted: 07 Jan 2018 12:56
by admin
Sure you can show milliseconds:
Re: SC <date> and milliseconds?
Posted: 07 Jan 2018 15:34
by Filehero
Why do I get an error for
datediff with the second code block?
Code: Select all
$start = <date YYYY-MM-DD hh:nn:ss>;
wait(1000);
$stop = <date YYYY-MM-DD hh:nn:ss>;
$runtime = datediff($start, $stop, "ms");
msg($runtime);
$start = <date YYYY-MM-DD hh:nn:ss.fff>;
wait(1000);
$stop = <date YYYY-MM-DD hh:nn:ss.fff>;
$runtime = datediff($start, $stop, "ms");
msg($runtime);
Re: SC <date> and milliseconds?
Posted: 07 Jan 2018 15:43
by jupe
I am no expert, so sorry if I am out of line here but for some reason I have found that date needs quoting when you use .fff so this works instead:
Code: Select all
$start = "<date YYYY-MM-DD hh:nn:ss.fff>";
wait(1000);
$stop = "<date YYYY-MM-DD hh:nn:ss.fff>";
$runtime = datediff($start, $stop, "ms");
msg($runtime);
Re: SC <date> and milliseconds?
Posted: 07 Jan 2018 15:46
by highend
date needs quoting when you use .fff
Correct
I'd call that a bug

Re: SC <date> and milliseconds?
Posted: 07 Jan 2018 15:53
by admin
It's because of the dot. Without quoting it is interpreted as concatenator.
Re: SC <date> and milliseconds?
Posted: 07 Jan 2018 15:57
by Filehero
Adding quotes was the only thing I didn't try, always thinking my date literal was wonky. Maybe my brain is starting to take off on Sunday as well.
Thanks to everybody.
Re: SC <date> and milliseconds?
Posted: 08 Jan 2018 20:44
by Filehero
Don, could you fix this?
Peter's
file property script is also evoking this error, so I think it is a regression.
Thanks, FH
Re: SC <date> and milliseconds?
Posted: 08 Jan 2018 20:52
by admin
Not a bug, but a syntax error. See change log:
Code: Select all
v16.90.0103 - 2016-06-07 23:35
> Scripting: Since the change in order of operator precedence in v16.80.0006
(2016-05-25 13:35), XY native variables with dots cannot be used unquoted
anymore because the dots are now seen as concatenators. For example, this
line will lead to a syntax error:
echo <prop #audio.bitrate>;
You have to do one of these to make it work:
echo <prop "#audio.bitrate">;
echo "<prop #audio.bitrate>";
Re: SC <date> and milliseconds?
Posted: 08 Jan 2018 20:54
by highend
Why not introduce an exception that doesn't parse them inside
variables?
Re: SC <date> and milliseconds?
Posted: 08 Jan 2018 21:15
by admin
Precedence is precedence. There shouldn't be exceptions at such a basic level.
Re: SC <date> and milliseconds?
Posted: 09 Jan 2018 06:16
by Filehero
admin wrote:Not a bug, but a syntax error. See change log:
Fair enough.
Though I never considered the „<>“ around the XX native variables to be operators but rather special quotes.
Re: SC <date> and milliseconds?
Posted: 09 Jan 2018 08:30
by admin
Many years ago I allowed them to be used unquoted, I think that was jacky's wish. Maybe shouldn't have done that. One exception leads the next...
... but I have to admit I got used it myself and was surprised that
doesn't work without quoting. After releasing 18.60.0100 I will try to improve the situation...