# 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

  • ONE

Functions - API calls offered directly by the extension

  • add
  • div
  • doesIntersect
  • eq
  • gcd
  • lt
  • max
  • min
  • mul
  • sub
  • tonumber
  • tostring
  • unm

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

  • new

# API Documentation

# Constants

# ONE

Signature cp.apple.fcpxml.time.ONE -> timeObject
Type Constant
Description A time object with a value of 0/1s.
Notes None
Source src/extensions/cp/apple/fcpxml/time.lua line 402

# Functions

# add

Signature cp.apple.fcpxml.time.add(a, b) -> timeObject
Type Function
Description Adds one time object to another.
Parameters
  • a - A time object.
  • b - A time object.
Returns
  • A new time object
Notes None
Examples None
Source src/extensions/cp/apple/fcpxml/time.lua line 131

# div

Signature cp.apple.fcpxml.time.div(a, b) -> timeObject
Type Function
Description Divides one time object with another.
Parameters
  • a - A time object.
  • b - A time object.
Returns
  • A new time object
Notes None
Examples None
Source src/extensions/cp/apple/fcpxml/time.lua line 228

# doesIntersect

Signature cp.apple.fcpxml.time.doesIntersect(aStart, aDuration, bStart, bDuration) -> boolean
Type Function
Description Checks 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
Notes None
Examples None
Source src/extensions/cp/apple/fcpxml/time.lua line 370

# eq

Signature cp.apple.fcpxml.time.eq(a, b) -> boolean
Type Function
Description Compares two time objects to ensure they're equal.
Parameters
  • a - A time object.
  • b - A time object.
Returns
  • A boolean
Notes None
Examples None
Source src/extensions/cp/apple/fcpxml/time.lua line 283

# gcd

Signature cp.apple.fcpxml.time.gcd(numerator, denominator) -> number
Type Function
Description Gets 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.
Notes None
Examples None
Source src/extensions/cp/apple/fcpxml/time.lua line 102

# lt

Signature cp.apple.fcpxml.time.lt(a, b) -> boolean
Type Function
Description Is time object A less than or equal to time object B?
Parameters
  • a - A time object.
  • b - A time object.
Returns
  • A boolean
Notes None
Examples None
Source src/extensions/cp/apple/fcpxml/time.lua line 318

# max

Signature cp.apple.fcpxml.time.max(a, b) -> timeObject
Type Function
Description Gets the bigger of the two time objects.
Parameters
  • a - A time object.
  • b - A time object.
Returns
  • A time object.
Notes None
Examples None
Source src/extensions/cp/apple/fcpxml/time.lua line 353

# min

Signature cp.apple.fcpxml.time.min(a, b) -> timeObject
Type Function
Description Gets the smaller of the two time objects.
Parameters
  • a - A time object.
  • b - A time object.
Returns
  • A time object.
Notes None
Examples None
Source src/extensions/cp/apple/fcpxml/time.lua line 336

# mul

Signature cp.apple.fcpxml.time.mul(object, value) -> timeObject
Type Function
Description To the power of a time value.
Parameters
  • object - A time object.
  • value - The power value
Returns
  • A new time object
Notes None
Examples None
Source src/extensions/cp/apple/fcpxml/time.lua line 208

# sub

Signature cp.apple.fcpxml.time.sub(a, b) -> timeObject
Type Function
Description Subtract one time object from another.
Parameters
  • a - A time object.
  • b - A time object.
Returns
  • A new time object
Notes None
Examples None
Source src/extensions/cp/apple/fcpxml/time.lua line 168

# tonumber

Signature cp.apple.fcpxml.time.tonumber(a) -> timeObject
Type Function
Description Gets the number value of a time object.
Parameters
  • a - A time object.
Returns
  • A number
Notes None
Examples None
Source src/extensions/cp/apple/fcpxml/time.lua line 269

# tostring

Signature cp.apple.fcpxml.time.tostring(a) -> timeObject
Type Function
Description Gets the string value of a time object.
Parameters
  • a - A time object.
Returns
  • A string
Notes None
Examples None
Source src/extensions/cp/apple/fcpxml/time.lua line 250

# unm

Signature cp.apple.fcpxml.time.unm(a) -> timeObject
Type Function
Description Negates a time object.
Parameters
  • a - A time object.
Returns
  • A new time object
Notes None
Examples None
Source src/extensions/cp/apple/fcpxml/time.lua line 151

# Constructors

# new

Signature cp.apple.fcpxml.time.new([numerator], [denominator]) -> timeObject
Type Constructor
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.
Notes None
Examples None
Source src/extensions/cp/apple/fcpxml/time.lua line 20