<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreMedia",
  "identifier" : "/documentation/CoreMedia/CMTimeMakeWithSeconds(_:preferredTimescale:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Media"
    ],
    "preciseIdentifier" : "c:@F@CMTimeMakeWithSeconds"
  },
  "title" : "CMTimeMakeWithSeconds(_:preferredTimescale:)"
}
-->

# CMTimeMakeWithSeconds(_:preferredTimescale:)

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

```
func CMTimeMakeWithSeconds(_ seconds: Float64, preferredTimescale: Int32) -> CMTime
```

## Parameters

`seconds`

The number of seconds to represent.

`preferredTimescale`

The preferred timescale of the time.

## Return Value

A time structure.

## 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)