function formatactualseconds(n: integer) :: string: if {_n} is greater than 86400: set {_days} to rounded down ({_n} / 86400) set {_timetocalc} to {_n} - ({_days} * 86400) else: set {_timetocalc} to {_n} set {_a} to "%{_timetocalc}% seconds" parsed as timespan set {_a} to "%{_a}%" replace all " seconds" or " second" with "s" in {_a} replace all " minutes" or " minute" with "m" in {_a} replace all " hours" or " hour" with "h" in {_a} replace all " days" or " day" with "d" in {_a} if {_a} does not contain "s": set {_split::*} to {_a} split at " and " replace "m" in {_split::2} with " minutes" set {_b} to "%{_split::2}%" parsed as timespan set {_b} to "%{_b}%" replace all " seconds" or " second" with "s" in {_b} replace all " minutes" or " minute" with "m" in {_b} replace all " hours" or " hour" with "h" in {_b} replace all " days" or " day" with "d" in {_b} replace all " and " with " " in {_b} if {_days} is greater than 0: return "%{_days}%d %{_split::1}% %{_b}%" else: if {_a} contain "s": return {_a} else: return "%{_split::1}% %{_b}%"