<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: -",
    "macOS: 10.7.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreMedia",
  "identifier" : "/documentation/CoreMedia/CMTime/init(seconds:preferredTimescale:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Core Media",
      "CoreMedia"
    ],
    "preciseIdentifier" : "s:So6CMTimea9CoreMediaE7seconds18preferredTimescaleABSd_s5Int32Vtcfc"
  },
  "title" : "init(seconds:preferredTimescale:)"
}
-->

# init(seconds:preferredTimescale:)

Creates a time that represents number of seconds in a preferred timescale.

```
init(seconds: Double, preferredTimescale: CMTimeScale)
```

## Parameters

`seconds`

The number of seconds to represent.

`preferredTimescale`

The preferred timescale of the time.

## Discussion

Specify a positive preferred timescale value, or the resulting time is [`invalid`](/documentation/CoreMedia/CMTime/invalid).

If you specify a value that causes an overflow, the system repeatedly halves the value until the overflow goes away or the timescale equals `1`. If the value still overflows at that point, the system sets the value to positive or negative infinity.

Query the [`hasBeenRounded`](/documentation/CoreMedia/CMTimeFlags/hasBeenRounded) property value to determine whether the value, when converted back to seconds, precisely matches the original seconds value.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)