#cp.apple.fcpxml.time

Allows you to convert time string values found in a FCPXML document into Lua objects, that do all the operations using rational numbers.

Final Cut Pro expresses time values as a rational number of seconds with a 64-bit numerator and a 32-bit denominator. Frame rates for NTSC-compatible media, for example, use a frame duration of 1001/30000s (29.97 fps) or 1001/60000s (59.94 fps). If a time value is equal to a whole number of seconds, Final Cut Pro may reduce the fraction into whole seconds (for example, 5s).


#API Overview

Constants - Useful values which cannot be changed

Functions - API calls offered directly by the extension

Constructors - API calls which return an object, typically one that offers API methods


#API Documentation

#Constants

Signaturecp.apple.fcpxml.time.ONE -> timeObject
TypeConstant
DescriptionA time object with a value of 0/1s.
NotesNone
Sourcesrc/extensions/cp/apple/fcpxml/time.lua line 402

#Functions

Signaturecp.apple.fcpxml.time.add(a, b) -> timeObject
TypeFunction
DescriptionAdds one time object to another.
Parameters
  • a - A time object.
  • b - A time object.
Returns
  • A new time object
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/apple/fcpxml/time.lua line 131

Signaturecp.apple.fcpxml.time.div(a, b) -> timeObject
TypeFunction
DescriptionDivides one time object with another.
Parameters
  • a - A time object.
  • b - A time object.
Returns
  • A new time object
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/apple/fcpxml/time.lua line 228

Signaturecp.apple.fcpxml.time.doesIntersect(aStart, aDuration, bStart, bDuration) -> boolean
TypeFunction
DescriptionChecks to see if two clips intersect.
Parameters
  • aStart - The start time of clip one as a time object.
  • aDuration - The duration of clip one as a time object.
  • bStart - The start time of clip two as a time object.
  • bDuration - The duration of clip two as a time object.
Returns
  • A boolean
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/apple/fcpxml/time.lua line 370

Signaturecp.apple.fcpxml.time.eq(a, b) -> boolean
TypeFunction
DescriptionCompares two time objects to ensure they're equal.
Parameters
  • a - A time object.
  • b - A time object.
Returns
  • A boolean
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/apple/fcpxml/time.lua line 283

Signaturecp.apple.fcpxml.time.gcd(numerator, denominator) -> number
TypeFunction
DescriptionGets the greatest common divisor.
Parameters
  • numerator - A numerator as a number
  • denominator - A denominator as a number
Returns
  • A number containing the greatest common divisor.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/apple/fcpxml/time.lua line 102

Signaturecp.apple.fcpxml.time.lt(a, b) -> boolean
TypeFunction
DescriptionIs time object A less than or equal to time object B?
Parameters
  • a - A time object.
  • b - A time object.
Returns
  • A boolean
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/apple/fcpxml/time.lua line 318

Signaturecp.apple.fcpxml.time.max(a, b) -> timeObject
TypeFunction
DescriptionGets the bigger of the two time objects.
Parameters
  • a - A time object.
  • b - A time object.
Returns
  • A time object.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/apple/fcpxml/time.lua line 353

Signaturecp.apple.fcpxml.time.min(a, b) -> timeObject
TypeFunction
DescriptionGets the smaller of the two time objects.
Parameters
  • a - A time object.
  • b - A time object.
Returns
  • A time object.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/apple/fcpxml/time.lua line 336

Signaturecp.apple.fcpxml.time.mul(object, value) -> timeObject
TypeFunction
DescriptionTo the power of a time value.
Parameters
  • object - A time object.
  • value - The power value
Returns
  • A new time object
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/apple/fcpxml/time.lua line 208

Signaturecp.apple.fcpxml.time.sub(a, b) -> timeObject
TypeFunction
DescriptionSubtract one time object from another.
Parameters
  • a - A time object.
  • b - A time object.
Returns
  • A new time object
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/apple/fcpxml/time.lua line 168

Signaturecp.apple.fcpxml.time.tonumber(a) -> timeObject
TypeFunction
DescriptionGets the number value of a time object.
Parameters
  • a - A time object.
Returns
  • A number
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/apple/fcpxml/time.lua line 269

Signaturecp.apple.fcpxml.time.tostring(a) -> timeObject
TypeFunction
DescriptionGets the string value of a time object.
Parameters
  • a - A time object.
Returns
  • A string
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/apple/fcpxml/time.lua line 250

Signaturecp.apple.fcpxml.time.unm(a) -> timeObject
TypeFunction
DescriptionNegates a time object.
Parameters
  • a - A time object.
Returns
  • A new time object
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/apple/fcpxml/time.lua line 151

#Constructors

Signaturecp.apple.fcpxml.time.new([numerator], [denominator]) -> timeObject
TypeConstructor
Description
Parameters
  • An optional numerator as a number (i.e. 3400) or a string value (i.e. "3400/2500s" or "2s"). Defaults to "0s".
  • A optional denominator as a number (i.e 2500)
Returns
  • A new cp.apple.fcpxml.time object.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/apple/fcpxml/time.lua line 20