Hi @Michael A. Lowry,
I would assume "this works like designed"...
The easiest way to transform seconds back to hours, minutes and seconds is probably this (the percent character means "modulo"):
:set &number_of_seconds# = "385"
:set &seconds# = &number_of_seconds# % 60
:set &seconds# = format(&seconds#,"00")
:set &minutes# = (&number_of_seconds# / 60) % 60
:set &minutes# = format(&minutes#,"00")
:set &hours# = (&number_of_seconds# / 3600)
:set &hours# = format(&hours#,"00")
: print &hours#:&minutes#:&seconds#
Cheers
Christoph
------------------------------
----------------------------------------------------------------
Automic AE Consultant and Trainer since 2000
----------------------------------------------------------------
------------------------------
Original Message:
Sent: Dec 12, 2022 06:02 PM
From: Michael Lowry
Subject: AE scripting: time functions trigger runtime error upon encountering input in seconds
Because there is no CONV_TIME
function, to convert from one time format to another one must use a function like DIFF_TIME
. (Subtracting zero seconds returns the same value, optionally in a different format.)
The following script fails with a runtime error on line 4.
:SET &HHMM# = "01:01":SET &SS# = DIFF_TIME("HH:MM;&HHMM#", "HH:MM;00:00", "SS"):PRINT &&SS# : &SS#:SET &HHMMSS# = DIFF_TIME("SS;&SS#", "SS;01", "HH:MM:SS"):PRINT &&HHMMSS : &HHMMSS#
The error is:
U00020437 Runtime error in object 'EBM.ARITHMETIC.SCRI', line '00004': Time '0000003661' does not correspond to time format 'SS'.
The same problem affects ADD_TIME
and SUB_TIME
. Declaring the &SS#
variable as signed, unsigned, or string does not help.
This seems like a bug. If it's possible to convert from HH:MM:SS to seconds, it ought to work the other way around.